diff options
Diffstat (limited to 'src/widgets/kernel/qtooltip.cpp')
-rw-r--r-- | src/widgets/kernel/qtooltip.cpp | 9 |
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(); |