summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qwhatsthis.cpp2
-rw-r--r--tests/auto/qtooltip/tst_qtooltip.cpp22
2 files changed, 23 insertions, 1 deletions
diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp
index 5e5e56f..0da3a9b 100644
--- a/src/gui/kernel/qwhatsthis.cpp
+++ b/src/gui/kernel/qwhatsthis.cpp
@@ -194,9 +194,9 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor
#ifndef QT_NO_CURSOR
setCursor(Qt::ArrowCursor);
#endif
-
QRect r;
doc = 0;
+ ensurePolished(); // Ensures style sheet font before size calc
if (Qt::mightBeRichText(text)) {
doc = new QTextDocument();
doc->setUndoRedoEnabled(false);
diff --git a/tests/auto/qtooltip/tst_qtooltip.cpp b/tests/auto/qtooltip/tst_qtooltip.cpp
index 283effa..fc76069 100644
--- a/tests/auto/qtooltip/tst_qtooltip.cpp
+++ b/tests/auto/qtooltip/tst_qtooltip.cpp
@@ -66,6 +66,7 @@ private slots:
// task-specific tests below me
void task183679_data();
void task183679();
+ void whatsThis();
void setPalette();
};
@@ -131,6 +132,27 @@ void tst_QToolTip::task183679()
QCOMPARE(QToolTip::isVisible(), visible);
}
+#include <QWhatsThis>
+
+void tst_QToolTip::whatsThis()
+{
+ qApp->setStyleSheet( "QWidget { font-size: 72px; }" );
+ QWhatsThis::showText(QPoint(0,0), "THis is text");
+ QTest::qWait(400);
+ QWidget *whatsthis = 0;
+ foreach (QWidget *widget, QApplication::topLevelWidgets()) {
+ if (widget->inherits("QWhatsThat")) {
+ whatsthis = widget;
+ break;
+ }
+ }
+ QVERIFY(whatsthis);
+ QVERIFY(whatsthis->isVisible());
+ QVERIFY(whatsthis->height() > 100); // Test QTBUG-2416
+ qApp->setStyleSheet("");
+}
+
+
void tst_QToolTip::setPalette()
{
//the previous test may still have a tooltip pending for deletion