From d4a4202caaf1676e8ae49359594d60895ff45d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 20 Mar 2020 17:27:33 +0100 Subject: [PATCH] widgets: Sync client rect of paint-on-screen widgets during resize Paint events are delivered with the client rect of the widget, and this applies to paint-on-screen widgets as well. The same goes for how the widget repaint manager tracks dirty rects. Internally we were also calling paintOnScreen() with client rects, so the use of geometry() in the resize handler was likely a bug/oversight. Change-Id: I1312ccf77218d1162e0971e4cbabaa80f49c852c Reviewed-by: Volker Hilsheimer --- src/widgets/kernel/qwidgetwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 67b7d05499..0239856ed9 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -813,16 +813,16 @@ void QWidgetWindow::handleMoveEvent(QMoveEvent *event) void QWidgetWindow::handleResizeEvent(QResizeEvent *event) { - QSize oldSize = m_widget->data->crect.size(); + auto oldRect = m_widget->rect(); if (updateSize()) { QGuiApplication::forwardEvent(m_widget, event); if (m_widget->d_func()->shouldPaintOnScreen()) { - QRegion updateRegion(geometry()); + QRegion dirtyRegion = m_widget->rect(); if (m_widget->testAttribute(Qt::WA_StaticContents)) - updateRegion -= QRect(0, 0, oldSize.width(), oldSize.height()); - m_widget->d_func()->syncBackingStore(updateRegion); + dirtyRegion -= oldRect; + m_widget->d_func()->syncBackingStore(dirtyRegion); } else { m_widget->d_func()->syncBackingStore(); }