diff options
author | Morten Johan Sørvig <morten.sorvig@qt.io> | 2020-08-07 11:36:31 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2020-08-19 15:01:45 +0200 |
commit | 733b65384468374d781455763a4dd32887b32626 (patch) | |
tree | 6cfc584e7128d4102ced7817a6fe1a3cd7912f5f | |
parent | ade59ea316dc17ff6c25fb10939a03008a70c11b (diff) |
Update QHighDpiScaling on DPI change
Make sure Qt reacts correctly to DPI changes while the
application is running, also when going from “standard-dpi”
to “high-dpi” (like Windows 100% to 200%).
Call QHighDpiScaling::upateHighDpiScaling() on DPI
change and update the m_usePixelDensity flag from there.
Fixes: QTBUG-85384
Pick-to: 5.15
Change-Id: I8ca83e4eea76cc8ba701a18e1f8c535b9953918f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qhighdpiscaling.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 6550725faa..89b16a39a7 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3092,6 +3092,8 @@ void QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(QWindowSystem if (QCoreApplication::startingUp()) return; + QHighDpiScaling::updateHighDpiScaling(); + if (!e->screen) return; diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index 726b7bc4b2..6c672ca7bf 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -495,6 +495,8 @@ void QHighDpiScaling::updateHighDpiScaling() if (QCoreApplication::testAttribute(Qt::AA_DisableHighDpiScaling)) return; + m_usePixelDensity = usePixelDensity(); + if (m_usePixelDensity && !m_pixelDensityScalingActive) { const auto screens = QGuiApplication::screens(); for (QScreen *screen : screens) { |