From 01cdda350290835194d1f4d40b54a91e238ca434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Fri, 3 Mar 2023 16:24:09 +0100 Subject: [PATCH] Update QWindow DPR on screen DPI change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The window device pixel ratio may change when the DPI changes. Call the DPR update function, which will poll for the current value and update the cached value and send DevicePixelRatioChanged events if needed. Change-Id: I5d5ac5d24a693d06eb9b1f005a91677e703f8a58 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qguiapplication.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 422c6ee8f69..8f806175c23 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3176,6 +3176,10 @@ void QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(QWindowSystem s->d_func()->updateGeometry(); } + for (QWindow *window : QGuiApplication::allWindows()) + if (window->screen() == e->screen) + QWindowPrivate::get(window)->updateDevicePixelRatio(); + resetCachedDevicePixelRatio(); }