aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <[email protected]>2025-01-16 13:11:47 +0100
committerTor Arne Vestbø <[email protected]>2025-01-16 20:31:06 +0100
commitf6d2929c9c1b15e6b51ec0f25ed84735c0c30375 (patch)
treedf545efcc9fba988abf869129c84c8c5512ee443
parent360a614f9672d8ae18d65488cda9414c9b06d283 (diff)
Process QQuickItemPrivate::transformChanged before recursing children
The child recursion logic in transformChanged notes that we "Inform the children in paint order: by the time we visit leaf items, they can see any consequences in their parents". This holds true for subclasses of QQuickItemPrivate, that process the call and then call the base class implementation. However in the case of updating the layer matrix we were doing it after recursing children, which breaks the documented logic. Similarly, we were notifying QQuickItem::ItemTransformHasChanged after recursion, which meant that observers would get callbacks in reverse paint order when observing a hierarchy of items. We now handle both these cases before recursing. Pick-to: 6.9 Change-Id: I373a2d7af11da65f66494322e44079ae04e95752 Reviewed-by: Oliver Eftevaag <[email protected]>
-rw-r--r--src/quick/items/qquickitem.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 6ca7eb52cf..c8a1283ad5 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -5465,6 +5465,15 @@ bool QQuickItemPrivate::transformChanged(QQuickItem *transformedItem)
{
Q_Q(QQuickItem);
+#if QT_CONFIG(quick_shadereffect)
+ if (q == transformedItem) {
+ if (extra.isAllocated() && extra->layer)
+ extra->layer->updateMatrix();
+ }
+#endif
+
+ itemChange(QQuickItem::ItemTransformHasChanged, transformedItem);
+
bool childWantsIt = false;
if (subtreeTransformChangedEnabled) {
// Inform the children in paint order: by the time we visit leaf items,
@@ -5474,12 +5483,6 @@ bool QQuickItemPrivate::transformChanged(QQuickItem *transformedItem)
childWantsIt |= QQuickItemPrivate::get(child)->transformChanged(transformedItem);
}
-#if QT_CONFIG(quick_shadereffect)
- if (q == transformedItem) {
- if (extra.isAllocated() && extra->layer)
- extra->layer->updateMatrix();
- }
-#endif
const bool thisWantsIt = q->flags().testFlag(QQuickItem::ItemObservesViewport);
const bool ret = childWantsIt || thisWantsIt;
if (!ret && componentComplete && subtreeTransformChangedEnabled) {
@@ -5491,7 +5494,6 @@ bool QQuickItemPrivate::transformChanged(QQuickItem *transformedItem)
if (thisWantsIt && q->clip() && !(dirtyAttributes & QQuickItemPrivate::Clip))
dirty(QQuickItemPrivate::Clip);
- itemChange(QQuickItem::ItemTransformHasChanged, transformedItem);
return ret;
}