diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-02-28 20:44:58 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-04-04 05:57:31 +0000 |
commit | 4e3c55e10da297e38ba45a35d7d0506b9f3bf989 (patch) | |
tree | 45e6ad3038f719b70ac14967ccbb7007961138ef /examples/widgets/graphicsview | |
parent | dc88477793f568e9154e7680866c1647763bdd2b (diff) |
Decouple rate-limiting of paint-on-screen widgets from top level widget
As part of eacd58d4e78e7238ba5fcca90ba960aaf3ebd263, a mechanism was
added to prevent posting redundant UpdateRequest events to the top
level widget, managed by QWidgetRepaintManager. The mechanism relied
on a boolean that was set when posting an update request event, and
reset when processing the event for the top level widget, as part
of QWidgetRepaintManager::sync().
However, for paint-on-screen widgets, we don't post an update request
to the top level, we post it to the paint-on-screen widget directly.
And when processing that event, we don't paint the widget though the
normal QWidgetRepaintManager machinery, but instead call the paint
event via QWidgetPrivate::paintOnScreen().
As a result, an update() on a paint-on-screen widget would result
in never receiving updates for non-paint-on-screen widgets, as
we assumed there was no reason to send further update requests.
We could fix this by clearing the updateRequestSent flag as part
of the paintOnScreen() code path, but that's incorrect as the flag
represents whether the top level QWidgetRepaintManager needs an
update request event or not, and would lead to missed updates
to normal widgets until the paint-on-screen widget finishes its
update.
Instead, we only set updateRequestSent if we're posting update
requests for non-paint-on-screen widgets, which in practice
means the top level widget.
The paint on screen logic in QWidgetRepaintManager::markDirty
still takes care of rate-limiting the update requests to the
paint-on-screen widget, by comparing the dirty area of the
widget.
There is definite room for improvement here, especially in the
direction of handling update requests via QWindow::requestUpdate
instead of manually posted events, but for now this will have to
do.
Fixes: QTBUG-80167
Pick-to: 6.5 6.2 5.15
Change-Id: Ib5685de7ca2fd7cd7883a25bb7bc0255ea242d30
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 697e1b0397259959e3f555296f87a0d9d923e4b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c198f7124cfb043ee1f04b13fc857bf3d5081bcd)
Diffstat (limited to 'examples/widgets/graphicsview')
0 files changed, 0 insertions, 0 deletions