diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-11-27 18:50:31 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-12-07 06:49:21 +0100 |
commit | 6eba6dd95082d5087662f9755d2f01ecb741ddc6 (patch) | |
tree | 2578663e1f735e4a32e8e5d4c74790a51e210d58 /src/quick/items/qquickitem.cpp | |
parent | d98821e4ebb7db10a99d5794538346422406446a (diff) |
QQuickItem: Call markSortedChildrenDirty before QQuickItemPrivate::dirty()
Marking an item dirty will normally result in adding the item to the
dirty list, and telling the window about it, via QQuickWindowPrivate's
dirtyItem(), which in turn does QQuickWindow::maybeUpdate().
This results in an asynchronous update, where we then render the scene
graph, including updating its paint nodes.
But QQuickItemPrivate::dirty() may also involve synchronous actions,
such as calling QQuickItemPrivate::transformChanged().
To be on the safe side, we markSortedChildrenDirty before dirtying,
so that any synchronous logic that runs as part of the dirtying will
observe the newly dirtied sorted children.
We were already doing this for QQuickItemPrivate::ChildrenChanged,
but not for QQuickItemPrivate::ChildrenStackingChanged.
Change-Id: I47f0ee81e17ed766ead7c7644596e90d240482a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquickitem.cpp')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 45179bca52..8b1188e4d4 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2803,8 +2803,8 @@ void QQuickItem::stackBefore(const QQuickItem *sibling) parentPrivate->childItems.move(myIndex, myIndex < siblingIndex ? siblingIndex - 1 : siblingIndex); - parentPrivate->dirty(QQuickItemPrivate::ChildrenStackingChanged); parentPrivate->markSortedChildrenDirty(this); + parentPrivate->dirty(QQuickItemPrivate::ChildrenStackingChanged); for (int ii = qMin(siblingIndex, myIndex); ii < parentPrivate->childItems.size(); ++ii) QQuickItemPrivate::get(parentPrivate->childItems.at(ii))->siblingOrderChanged(); @@ -2848,8 +2848,8 @@ void QQuickItem::stackAfter(const QQuickItem *sibling) parentPrivate->childItems.move(myIndex, myIndex > siblingIndex ? siblingIndex + 1 : siblingIndex); - parentPrivate->dirty(QQuickItemPrivate::ChildrenStackingChanged); parentPrivate->markSortedChildrenDirty(this); + parentPrivate->dirty(QQuickItemPrivate::ChildrenStackingChanged); for (int ii = qMin(myIndex, siblingIndex + 1); ii < parentPrivate->childItems.size(); ++ii) QQuickItemPrivate::get(parentPrivate->childItems.at(ii))->siblingOrderChanged(); @@ -6002,8 +6002,8 @@ void QQuickItem::setZ(qreal v) d->dirty(QQuickItemPrivate::ZValue); if (d->parentItem) { - QQuickItemPrivate::get(d->parentItem)->dirty(QQuickItemPrivate::ChildrenStackingChanged); QQuickItemPrivate::get(d->parentItem)->markSortedChildrenDirty(this); + QQuickItemPrivate::get(d->parentItem)->dirty(QQuickItemPrivate::ChildrenStackingChanged); } emit zChanged(); |