QmlDesigner: Add child nodes when writing node to qml

Change-Id: Iddf6b70010fe34a292d8b8019c6263a56c383d75
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Mahmoud Badri
2024-06-27 17:52:08 +03:00
parent a9426e1977
commit c6531e02cf

View File

@@ -596,6 +596,17 @@ QPair<QString, QSet<QString>> ContentLibraryView::modelNodeToQmlString(const Mod
} }
} }
// add child nodes
const ModelNodes nodeChildren = node.directSubModelNodes();
for (const ModelNode &childNode : nodeChildren) {
if (childNode && !depListIds.contains(childNode.id())) {
depListIds.append(childNode.id());
auto [depQml, depAssets] = modelNodeToQmlString(childNode, depth + 1);
qml += "\n" + depQml + "\n";
assets.unite(depAssets);
}
}
indent = QString(" ").repeated(depth * 4); indent = QString(" ").repeated(depth * 4);
qml += indent + "}\n"; qml += indent + "}\n";