Determine screen with initialGeometry when not positioning automatically
Popups aren't automatically positioned, so use the screen at the initial geometry for scaling. Otherwise we may end up with the wrong geometry on systems that have multiple screens with different scales. Pick-to: 6.9 6.8 Fixes: QTBUG-134139 Change-Id: I686b1c8ab6cf458d9b849b529ba247ac8c3be064 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
7af5912e61
commit
7dc2532bed
@ -702,10 +702,10 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, const QRect &initialGeo
|
|||||||
return QRect(initialGeometry.topLeft(), QHighDpi::toNative(deviceIndependentSize, factor));
|
return QRect(initialGeometry.topLeft(), QHighDpi::toNative(deviceIndependentSize, factor));
|
||||||
}
|
}
|
||||||
const auto *wp = qt_window_private(const_cast<QWindow*>(w));
|
const auto *wp = qt_window_private(const_cast<QWindow*>(w));
|
||||||
const bool position = wp->positionAutomatic && w->type() != Qt::Popup;
|
const bool positionAutomatic = wp->positionAutomatic && w->type() != Qt::Popup;
|
||||||
if (!position && !wp->resizeAutomatic)
|
if (!positionAutomatic && !wp->resizeAutomatic)
|
||||||
return initialGeometry;
|
return initialGeometry;
|
||||||
const QScreen *screen = wp->positionAutomatic
|
const QScreen *screen = positionAutomatic
|
||||||
? effectiveScreen(w)
|
? effectiveScreen(w)
|
||||||
: QGuiApplication::screenAt(initialGeometry.center());
|
: QGuiApplication::screenAt(initialGeometry.center());
|
||||||
if (!screen)
|
if (!screen)
|
||||||
@ -717,7 +717,7 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w, const QRect &initialGeo
|
|||||||
if (wp->resizeAutomatic)
|
if (wp->resizeAutomatic)
|
||||||
deviceIndependentRect.setSize(
|
deviceIndependentRect.setSize(
|
||||||
fixInitialSize(deviceIndependentRect.size(), w, defaultWidth, defaultHeight));
|
fixInitialSize(deviceIndependentRect.size(), w, defaultWidth, defaultHeight));
|
||||||
if (position) {
|
if (positionAutomatic) {
|
||||||
const QRect availableDeviceIndependentGeometry = screen->availableGeometry();
|
const QRect availableDeviceIndependentGeometry = screen->availableGeometry();
|
||||||
// Center unless the geometry ( + unknown window frame) is too large for the screen).
|
// Center unless the geometry ( + unknown window frame) is too large for the screen).
|
||||||
if (deviceIndependentRect.height() < (availableDeviceIndependentGeometry.height() * 8) / 9
|
if (deviceIndependentRect.height() < (availableDeviceIndependentGeometry.height() * 8) / 9
|
||||||
|
Loading…
x
Reference in New Issue
Block a user