summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2023-03-03 16:24:09 +0100
committerMorten Sørvig <morten.sorvig@qt.io>2023-04-11 17:13:14 +0100
commit01cdda350290835194d1f4d40b54a91e238ca434 (patch)
tree85b97ad7f79445e32453810f4baa4ec7a71277e6
parent3965d808c086af9a4e4740ab2c7efe1a7ef6cb01 (diff)
downloadqtbase-01cdda350290835194d1f4d40b54a91e238ca434.tar.gz
Update QWindow DPR on screen DPI change
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ø <tor.arne.vestbo@qt.io>
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 422c6ee8f6..8f806175c2 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();
}