summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwindow.cpp
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2023-08-21 16:19:00 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2023-10-02 12:50:57 +0000
commit5f1c29376c02f722450f6bf1aa5f0647601e0e59 (patch)
treeb176ec193c7b4889f8b5fd7e4975264edf6e7970 /src/gui/kernel/qwindow.cpp
parent628692a2f2950b7c25dfa45637d7d063792188cb (diff)
Add catch-all DPR update to expose event handling
The platform plugin should already DPR (or DPI) change events, however if that does not happen we update in the expose event as well as a last resort to make sure the window's DPR value is in sync. Also print a warning and ask for a bug report. Pick-to: 6.6 6.0 Change-Id: Ibb144f163281a28216c2fa3353ed50237e91ce25 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/gui/kernel/qwindow.cpp')
-rw-r--r--src/gui/kernel/qwindow.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 00d66913e1..691bc5c269 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1358,8 +1358,9 @@ qreal QWindow::devicePixelRatio() const
/*
Updates the cached devicePixelRatio value by polling for a new value.
Sends QEvent::DevicePixelRatioChange to the window if the DPR has changed.
+ Returns true if the DPR was changed.
*/
-void QWindowPrivate::updateDevicePixelRatio()
+bool QWindowPrivate::updateDevicePixelRatio()
{
Q_Q(QWindow);
@@ -1370,11 +1371,12 @@ void QWindowPrivate::updateDevicePixelRatio()
platformWindow->devicePixelRatio() * QHighDpiScaling::factor(q) : q->screen()->devicePixelRatio();
if (newDevicePixelRatio == devicePixelRatio)
- return;
+ return false;
devicePixelRatio = newDevicePixelRatio;
QEvent dprChangeEvent(QEvent::DevicePixelRatioChange);
QGuiApplication::sendEvent(q, &dprChangeEvent);
+ return true;
}
Qt::WindowState QWindowPrivate::effectiveState(Qt::WindowStates state)