QmlDesigner: Fix root item effect rendering

ShaderEffects affecting root item are now correctly triggering root item
render if they have changes.

Fixes: QDS-15085
Change-Id: I7e675a9514e0de0a45d0709ff5e59e8371700b45
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Miikka Heikkinen
2025-04-10 17:13:01 +03:00
parent c4efb9c96c
commit 5982ab8074
2 changed files with 17 additions and 4 deletions

View File

@@ -189,10 +189,21 @@ QList<QQuickItem*> subItems(QQuickItem *parentItem)
const QList<QQuickItem*> Qt5NodeInstanceServer::allItems() const
{
if (rootNodeInstance().isValid())
return rootNodeInstance().allItemsRecursive();
if (!rootNodeInstance().isValid())
return {};
return {};
QList<QQuickItem*> allItems = rootNodeInstance().allItemsRecursive();
// ShaderEffects affecting root item will be root item siblings, so add those as well
QQuickItem *rootItem = rootNodeInstance().rootQuickItem();
if (rootItem && rootItem->parentItem()) {
const QList<QQuickItem *> siblings = rootItem->parentItem()->childItems();
for (QQuickItem *sibling : siblings) {
if (sibling != rootItem)
allItems.append(sibling);
}
}
return allItems;
}
bool Qt5NodeInstanceServer::rootIsRenderable3DObject() const

View File

@@ -163,7 +163,9 @@ ServerNodeInstance Qt5RenderNodeInstanceServer::findNodeInstanceForItem(QQuickIt
if (item) {
if (hasInstanceForObject(item))
return instanceForObject(item);
else if (item->parentItem())
else if (item == rootNodeInstance().rootQuickItem()->parentItem())
return rootNodeInstance();
else
return findNodeInstanceForItem(item->parentItem());
}