diff options
author | Tor Arne Vestbø <torarnv@gmail.com> | 2020-03-20 17:27:33 +0100 |
---|---|---|
committer | Tor Arne Vestbø <torarnv@gmail.com> | 2020-03-27 11:19:52 +0100 |
commit | d4a4202caaf1676e8ae49359594d60895ff45d20 (patch) | |
tree | ad12931ef67301ff34dd3a2941842188bddc0c2c /src | |
parent | 643410136004825cb395e342f5c4ff90e85de4fe (diff) |
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 <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 8 |
1 files 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(); } |