summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformwindow.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-27 09:16:56 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-05-27 09:17:14 +0200
commit761b71bd20524bc1e495508a52c38a0bc6679a06 (patch)
treedf2748fb11234c9b0dfb82828ce8d76459d185db /src/gui/kernel/qplatformwindow.cpp
parent800941df899a4418d4ac6cebbcc31a40120167bc (diff)
parent14aa1f7d6ffea29647557f98e654355782f55e66 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r--src/gui/kernel/qplatformwindow.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 562289a8c9..4e95751397 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -705,14 +705,20 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w,
w, defaultWidth, defaultHeight);
return QRect(initialGeometry.topLeft(), QHighDpi::toNative(size, factor));
}
- const QScreen *screen = effectiveScreen(w);
+ const auto *wp = qt_window_private(const_cast<QWindow*>(w));
+ const bool position = wp->positionAutomatic && w->type() != Qt::Popup;
+ if (!position && !wp->resizeAutomatic)
+ return initialGeometry;
+ const QScreen *screen = wp->positionAutomatic
+ ? effectiveScreen(w)
+ : QGuiApplication::screenAt(initialGeometry.center());
if (!screen)
return initialGeometry;
- const auto *wp = qt_window_private(const_cast<QWindow*>(w));
+ // initialGeometry refers to window's screen
QRect rect(QHighDpi::fromNativePixels(initialGeometry, w));
if (wp->resizeAutomatic)
rect.setSize(fixInitialSize(rect.size(), w, defaultWidth, defaultHeight));
- if (wp->positionAutomatic && w->type() != Qt::Popup) {
+ if (position) {
const QRect availableGeometry = screen->availableGeometry();
// Center unless the geometry ( + unknown window frame) is too large for the screen).
if (rect.height() < (availableGeometry.height() * 8) / 9