From f2bfd584d0cf8ed6ae551fd603f9a3928eb22621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 14 Oct 2019 00:07:57 +0200 Subject: [PATCH] Fixed flickering & QT4 problems --- src/GUI/popup.cpp | 12 +++++------- src/GUI/tooltip.cpp | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/GUI/popup.cpp b/src/GUI/popup.cpp index 72dc43f1..c41668f9 100644 --- a/src/GUI/popup.cpp +++ b/src/GUI/popup.cpp @@ -9,8 +9,6 @@ #include #include "popup.h" -#include - class Label : public QLabel { @@ -28,6 +26,7 @@ public: protected: void paintEvent(QPaintEvent *event); void timerEvent(QTimerEvent *event); + void contextMenuEvent(QContextMenuEvent *) {} private: QBasicTimer _timer; @@ -107,7 +106,7 @@ bool Label::eventFilter(QObject *o, QEvent *ev) break; case QEvent::MouseMove: { QRectF r(geometry().adjusted(-5, -20, 5, 20)); - QPointF p(static_cast(ev)->screenPos()); + QPointF p(static_cast(ev)->globalPos()); if (!r.contains(p)) deleteAfterTimer(); break; @@ -152,11 +151,10 @@ void Popup::show(const QPoint &pos, const QString &text, QWidget *w) if (Label::_instance) { Label::_instance->stopTimer(); Label::_instance->setText(text); - Label::_instance->resize(Label::_instance->sizeHint()); - } else { + } else Label::_instance = new Label(text); - Label::_instance->showNormal(); - } + Label::_instance->resize(Label::_instance->sizeHint()); Label::_instance->place(pos, w); + Label::_instance->showNormal(); } diff --git a/src/GUI/tooltip.cpp b/src/GUI/tooltip.cpp index d96270cc..e4e44bd0 100644 --- a/src/GUI/tooltip.cpp +++ b/src/GUI/tooltip.cpp @@ -29,7 +29,7 @@ QString ToolTip::toString() const html += "
"; html += QString("" - "") + "") .arg(_img.path(), QString::number(width), QString::number(height)); html += "
"; }