Update the cached DPR on QWindow update request

Follow-up from commit 299dfe which added a similar update
for expose events. This fixes missing DPR updates for
exposed windows.

Pick-to: 6.6
Change-Id: Ic1a9a41bd979270b97303abb71f1230bff001d19
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 041ca2a3a818955ebcbbc0acd164138ffd561a6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Morten Sørvig 2024-04-15 11:49:51 +02:00 committed by Qt Cherry-pick Bot
parent 957dd4e145
commit 8baa2b73a4

View File

@ -778,6 +778,15 @@ void QPlatformWindow::deliverUpdateRequest()
QWindow *w = window();
QWindowPrivate *wp = qt_window_private(w);
// We expect that the platform plugins send DevicePixelRatioChange events.
// As a fail-safe make a final check here to make sure the cached DPR value is
// always up to date before delivering the update request.
if (wp->updateDevicePixelRatio()) {
qWarning() << "The cached device pixel ratio value was stale on window update. "
<< "Please file a QTBUG which explains how to reproduce.";
}
wp->updateRequestPending = false;
QEvent request(QEvent::UpdateRequest);
QCoreApplication::sendEvent(w, &request);