QDialog::adjustPosition(): Check screen number

The screen number has been observed to be -1 in setups
with multiple virtual desktops.
Amends change eb50193136c7c73be864e3232d01e98ddc24e539.

Task-number: QTBUG-52735
Change-Id: If01acf74fdd701a9211df732c0defdfd522ba72d
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Friedemann Kleint 2016-07-26 09:10:58 +02:00
parent 7095db3633
commit d57bfa21ce

View File

@ -863,8 +863,10 @@ void QDialog::adjustPosition(QWidget* w)
// 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 (scrn >= 0) {
if (QWindow *window = windowHandle())
window->setScreen(QGuiApplication::screens().at(scrn));
}
move(p);
}