diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index ae86167545829fe48246b6eb9b9a3b90ac0d4a60..30b5d43acd566d90a9dccb7201b75ac0cf2bfed5 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -390,6 +390,7 @@ void NodeInstanceView::instancePropertyChange(const QList<QPair<ModelNode, QStri //\} + void NodeInstanceView::loadNodes(const QList<ModelNode> &nodeList) { foreach (const ModelNode &node, nodeList) @@ -405,8 +406,11 @@ void NodeInstanceView::loadNodes(const QList<ModelNode> &nodeList) instanceForNode(node).setPropertyBinding(property.name(), property.expression()); } - foreach(NodeInstance instance, m_objectInstanceHash.values()) - instance.doComponentComplete(); + QListIterator<ModelNode> listIterator(nodeList); + listIterator.toBack(); + + while (listIterator.hasPrevious()) + instanceForNode(listIterator.previous()).doComponentComplete(); } // TODO: Set base state as current model state diff --git a/src/plugins/qmldesigner/designercore/model/model.cpp b/src/plugins/qmldesigner/designercore/model/model.cpp index 8f93153cb6f372228bb63c66387212e4f4d5bdd5..b6794b3f1f260c9d52350de9dc127ca3706ab87b 100644 --- a/src/plugins/qmldesigner/designercore/model/model.cpp +++ b/src/plugins/qmldesigner/designercore/model/model.cpp @@ -1218,7 +1218,18 @@ bool ModelPrivate::hasId(const QString &id) const QList<InternalNodePointer> ModelPrivate::allNodes() const { - return m_nodeSet.toList(); + // the item must be ordered! + + QList<InternalNodePointer> nodeList; + + if (m_rootInternalNode.isNull() || !m_rootInternalNode->isValid()) + return nodeList; + + nodeList.append(m_rootInternalNode); + nodeList.append(m_rootInternalNode->allSubNodes()); + + + return nodeList; } bool ModelPrivate::isWriteLocked() const