diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-02-13 08:48:25 +0100 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2017-02-16 15:31:38 +0000 |
commit | cd2b5f1ada07fc7a5ec31e3b48a7fdf76bf62020 (patch) | |
tree | 882e22fc30624de0f5f4883d658ebad7bc170c9f /src/plugins/platforms/windows/qwindowscontext.cpp | |
parent | 2b34aefcf02f09253473b096eb4faffd3e62b5f4 (diff) |
Resize the window when the screen's dpi changes
That's what the MSDN documentation say one should do in the handler
for WM_DPICHANGED
[ChangeLog][QtGui][Windows] Windows are now automatically resized
when they are moved on a screen to adapt to the new pixel ratio.
Task-number: QTBUG-55510
Task-number: QTBUG-48242
Change-Id: I7688f12165f76585d75686e2e94b0fc562627be2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index fefc848d01..5745fc6d19 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -1088,6 +1088,15 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true; #endif } break; + case QtWindows::DpiChangedEvent: { + platformWindow->setFlag(QWindowsWindow::WithinDpiChanged); + const RECT *prcNewWindow = reinterpret_cast<RECT *>(lParam); + SetWindowPos(hwnd, NULL, prcNewWindow->left, prcNewWindow->top, + prcNewWindow->right - prcNewWindow->left, + prcNewWindow->bottom - prcNewWindow->top, SWP_NOZORDER | SWP_NOACTIVATE); + platformWindow->clearFlag(QWindowsWindow::WithinDpiChanged); + return true; + } #if !defined(QT_NO_SESSIONMANAGER) case QtWindows::QueryEndSessionApplicationEvent: { QWindowsSessionManager *sessionManager = platformSessionManager(); |