summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qtooltip.cpp6
-rw-r--r--tests/auto/qtooltip/tst_qtooltip.cpp11
2 files changed, 11 insertions, 6 deletions
diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp
index a480195..2d0d209 100644
--- a/src/gui/kernel/qtooltip.cpp
+++ b/src/gui/kernel/qtooltip.cpp
@@ -290,8 +290,8 @@ void QTipLabel::timerEvent(QTimerEvent *e)
// Fade out tip on mac (makes it invisible).
// The tip will not be deleted until a new tip is shown.
- // DRSWAT - Cocoa
- macWindowFade(qt_mac_window_for(this));
+ // DRSWAT - Cocoa
+ macWindowFade(qt_mac_window_for(this));
QTipLabel::instance->fadingOut = true; // will never be false again.
}
else
@@ -431,7 +431,7 @@ bool QTipLabel::tipChanged(const QPoint &pos, const QString &text, QObject *o)
void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect)
{
- if (QTipLabel::instance){ // a tip does already exist
+ if (QTipLabel::instance && QTipLabel::instance->isVisible()){ // a tip does already exist
if (text.isEmpty()){ // empty text means hide current tip
QTipLabel::instance->hideTip();
return;
diff --git a/tests/auto/qtooltip/tst_qtooltip.cpp b/tests/auto/qtooltip/tst_qtooltip.cpp
index 5068460..2ad74a3 100644
--- a/tests/auto/qtooltip/tst_qtooltip.cpp
+++ b/tests/auto/qtooltip/tst_qtooltip.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include <qtooltip.h>
+#include "../../shared/util.h"
//TESTED_CLASS=
//TESTED_FILES=
@@ -132,20 +133,24 @@ void tst_QToolTip::task183679()
void tst_QToolTip::setPalette()
{
//the previous test may still have a tooltip pending for deletion
- QTest::qWait(100);
QVERIFY(!QToolTip::isVisible());
QToolTip::showText(QPoint(), "tool tip text", 0);
- QTest::qWait(100);
+
+ QTRY_VERIFY(QToolTip::isVisible());
QWidget *toolTip = 0;
foreach (QWidget *widget, QApplication::topLevelWidgets()) {
- if (widget->windowType() == Qt::ToolTip) {
+ if (widget->windowType() == Qt::ToolTip
+ && widget->objectName() == QLatin1String("qtooltip_label"))
+ {
toolTip = widget;
break;
}
}
+
QVERIFY(toolTip);
+ QTRY_VERIFY(toolTip->isVisible());
const QPalette oldPalette = toolTip->palette();
QPalette newPalette = oldPalette;