From eb50193136c7c73be864e3232d01e98ddc24e539 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 26 Apr 2016 14:33:17 +0200 Subject: 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 --- src/widgets/dialogs/qdialog.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/widgets/dialogs') diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 5124960ab4..45d2279ed5 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -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); } -- cgit v1.2.3