windows qpa: re-apply 8d6e825d

“Handle invisible child windows gracefully on dpi changes”

This fix was accidentally removed by commit cd96d870
“Move VM_DPICHANGE handling to QWindowsWindow”.

Fixes: QTBUG-96466
Pick-to: 6.2
Change-Id: I3774f6305631ba47282d43e8480e2acaba517a96
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Morten Johan Sørvig 2021-10-29 12:39:00 +02:00
parent c78a652bd2
commit e7371fa159

View File

@ -1888,6 +1888,8 @@ void QWindowsWindow::handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam)
// Scale child QPlatformWindow size. Windows sends WM_DPICHANGE to top-level windows only.
for (QWindow *childWindow : window()->findChildren<QWindow *>()) {
QWindowsWindow *platformChildWindow = static_cast<QWindowsWindow *>(childWindow->handle());
if (!platformChildWindow)
continue;
QRect currentGeometry = platformChildWindow->geometry();
QRect scaledGeometry = QRect(currentGeometry.topLeft() * scale, currentGeometry.size() * scale);
platformChildWindow->setGeometry(scaledGeometry);