QDialog::adjustPosition(): Manually set target screen before moving.

QDialog::adjustPosition() can move the dialog across screens. A call to
QWindow::resize() later in the show sequence might then see the wrong scaling
factor if the screen changed notification is still stuck in an event queue.
Prevent that by setting the target screen early on.

Task-number: QTBUG-52735
Change-Id: I17bb3490b660f8f17c36524457cb87adbb7851e9
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
Friedemann Kleint 2016-04-26 14:33:17 +02:00
parent 2f0ffba638
commit eb50193136

View File

@ -860,6 +860,12 @@ void QDialog::adjustPosition(QWidget* w)
if (p.y() < desk.y())
p.setY(desk.y());
// QTBUG-52735: Manually set the correct target screen since scaling in a
// subsequent call to QWindow::resize() may otherwise use the wrong factor
// if the screen changed notification is still in an event queue.
if (QWindow *window = windowHandle())
window->setScreen(QGuiApplication::screens().at(scrn));
move(p);
}