summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qtooltip.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-01-08 09:34:24 +0100
committerLiang Qi <liang.qi@qt.io>2019-01-08 09:34:24 +0100
commit0e96b5fe482802935ae202e2297404845e440d71 (patch)
tree79c566f18bc605261f69d750d2935b91edba3861 /src/widgets/kernel/qtooltip.cpp
parentda43362921a62ea3163a042be20ec0f550d05cfa (diff)
parent5733dfbd90fd059e7310786faefb022b00289592 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.12.1
Conflicts: src/widgets/kernel/qtooltip.cpp Change-Id: Ic2f9a425359050eb56b3a4e5162cf5e3447058c8
Diffstat (limited to 'src/widgets/kernel/qtooltip.cpp')
-rw-r--r--src/widgets/kernel/qtooltip.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index b9d8758fe0..cf0f3f153b 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -41,6 +41,7 @@
#endif
#include <QtWidgets/private/qtwidgetsglobal_p.h>
+#include <QtWidgets/private/qlabel_p.h>
#include <qapplication.h>
#include <qdesktopwidget.h>
@@ -127,6 +128,7 @@ public:
~QTipLabel();
static QTipLabel *instance;
+ void adjustTooltipScreen(const QPoint &pos);
void updateSize(const QPoint &pos);
bool eventFilter(QObject *, QEvent *) override;
@@ -221,6 +223,12 @@ void QTipLabel::reuseTip(const QString &text, int msecDisplayTime, const QPoint
void QTipLabel::updateSize(const QPoint &pos)
{
+#ifndef Q_OS_WINRT
+ // ### The code below does not always work well on WinRT
+ // (e.g COIN fails an auto test - tst_QToolTip::qtbug64550_stylesheet - QTBUG-72652)
+ d_func()->setScreenForPoint(pos);
+#endif
+ // Ensure that we get correct sizeHints by placing this window on the right screen.
QFontMetrics fm(font());
QSize extra(1, 0);
// Make it look good with the default ToolTip font on Mac, which has a small descent.
@@ -228,6 +236,7 @@ void QTipLabel::updateSize(const QPoint &pos)
++extra.rheight();
setWordWrap(Qt::mightBeRichText(text()));
QSize sh = sizeHint();
+ // ### When the above WinRT code is fixed, windowhandle should be used to find the screen.
QScreen *screen = QGuiApplication::screenAt(pos);
if (!screen)
screen = QGuiApplication::primaryScreen();