summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2020-08-21 14:48:50 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2020-10-23 20:19:45 +0200
commit074f71cfdabd49ae23ac956a9459c8e13f8e627e (patch)
tree31851b731c02c3a809e488022e3582c1b48342cb /src
parent07466a52c60dca9c1aeb1d40423bb9427d1a9583 (diff)
Display tooltips on the correct screen
Display QTipLabel on the correct screen, also when the parent widget spans multiple screens. In this case, QWidget::screen() will return the main screen for the widget, which will not necessarily be the screen at the tool tip position. Fixes regression introduced by 7e2fded5. Change-Id: Iffb920b6658468c5032928eadbd749f58fe077a7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/kernel/qtooltip.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index ca29cdcc9c..b397bf9835 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -361,7 +361,9 @@ bool QTipLabel::eventFilter(QObject *o, QEvent *e)
QScreen *QTipLabel::getTipScreen(const QPoint &pos, QWidget *w)
{
- return w ? w->screen() : QGuiApplication::primaryScreen()->virtualSiblingAt(pos);
+ QScreen *guess = w ? w->screen() : QGuiApplication::primaryScreen();
+ QScreen *exact = guess->virtualSiblingAt(pos);
+ return exact ? exact : guess;
}
void QTipLabel::placeTip(const QPoint &pos, QWidget *w)