1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 06:43:22 +02:00

Fixed flickering & QT4 problems

This commit is contained in:
Martin Tůma 2019-10-14 00:07:57 +02:00
parent a9ce6f54c7
commit f2bfd584d0
2 changed files with 6 additions and 8 deletions

View File

@ -9,8 +9,6 @@
#include <QBasicTimer>
#include "popup.h"
#include <QDebug>
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<QMouseEvent*>(ev)->screenPos());
QPointF p(static_cast<QMouseEvent*>(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();
}

View File

@ -29,7 +29,7 @@ QString ToolTip::toString() const
html += "<div align=\"center\">";
html += QString("<a href=\"file:%0\">"
"<img src=\"file:%0\" width=\"%1\" height=\"%2\"/></a>")
"<img src=\"%0\" width=\"%1\" height=\"%2\"/></a>")
.arg(_img.path(), QString::number(width), QString::number(height));
html += "</div>";
}