summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-09-14 11:21:22 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2009-09-14 11:29:01 (GMT)
commitc5a8d26d2337c3ed01f66783b69c5090c515be38 (patch)
tree9275c0da1f8deadf9b24ba9ec5c1eca91c5318c6
parent53ea5e98eab90ee9e3ae23e3b67e8993e6c2b31c (diff)
downloadQt-c5a8d26d2337c3ed01f66783b69c5090c515be38.zip
Qt-c5a8d26d2337c3ed01f66783b69c5090c515be38.tar.gz
Qt-c5a8d26d2337c3ed01f66783b69c5090c515be38.tar.bz2
Fix whatsThis breakage when using custom style sheet font
When setting a large font using style sheets, the whats this popup size calculation would be incorrect resulting in half visible lables. By calling ensurePolished before showing the label, we ensure that this will be properly handled. We also added a new test case for whatsThis in tst_qtooltip Task-number: QTBUG-2416 Reviewed-by: ogoffart
-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