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>
This commit is contained in:
Morten Johan Sørvig 2020-08-21 14:48:50 +02:00
parent 07466a52c6
commit 074f71cfda

View File

@ -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)