diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-10-14 17:44:29 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-10-15 20:03:34 +0200 |
commit | dedb29cf23959741593b2fa1481f210cd663cafb (patch) | |
tree | 9dab3585e12653d5ada408067571cd40391f76b9 /src | |
parent | aad4158959890b72afdd062614c1142c100c65b5 (diff) |
Fix high DPI position of foreign child windows on Windows
Suppose you have a child window that is a foreign window. In the bug
report's example it's a QAxWidget that wraps the Windows Media Player.
This means, we have a non-top-level QWindow with a platformWindow
assigned. If windows:dpiawareness is set to 1 (system-DPI aware) and
the window is displayed on a screen with origin != (0, 0), then we
called QPlatformWindow::setGeometry with a position in native
coordinates. This moved the child window outside of the visible area.
Fix this by calling QHighDpi::toNativeWindowGeometry instead of
QHighDpi::toNativePixels. The former function takes child windows
properly into account.
Pick-to: 6.2
Fixes: QTBUG-96114
Change-Id: Ibb0f844b10aece8ede99cb34289c0430ac283fa0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 61756a3834..275d190a5a 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1940,7 +1940,8 @@ void QWindow::resize(const QSize &newSize) Q_D(QWindow); d->positionPolicy = QWindowPrivate::WindowFrameExclusive; if (d->platformWindow) { - d->platformWindow->setGeometry(QHighDpi::toNativePixels(QRect(position(), newSize), this)); + d->platformWindow->setGeometry( + QHighDpi::toNativeWindowGeometry(QRect(position(), newSize), this)); } else { const QSize oldSize = d->geometry.size(); d->geometry.setSize(newSize); |