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>bb10
parent
aad4158959
commit
dedb29cf23
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue