void NodeElement::updateChildrenOrder() { QStringList ids; if (mGraphicalAssistApi.properties(mId).contains("childrenOrder")) { ids = mGraphicalAssistApi.graphicalRepoApi().property(mId, "childrenOrder").toStringList(); } EditorViewScene *evScene = dynamic_cast<EditorViewScene *>(scene()); if (evScene) { QStringList idsForRemoving; for (const QString &id : ids) { if (!evScene->getNodeById(Id::loadFromString(id))) { idsForRemoving.append(id); } } for (const QString &id : idsForRemoving) { ids.removeAll(id); } } QList<NodeElement *> children = childNodes(); for (NodeElement *child : children) { if (!ids.contains(child->id().toString())) { ids << child->id().toString(); } } mGraphicalAssistApi.mutableGraphicalRepoApi().setProperty(mId, "childrenOrder", ids); }
QList<NodeElement *> ResizeHandler::sortedChildrenList() const { QList<NodeElement *> result; IdList childrenIds = mTargetNode.sortedChildren(); EditorViewScene *evScene = dynamic_cast<EditorViewScene *>(mTargetNode.scene()); for (const Id &id : childrenIds) { NodeElement *child = evScene->getNodeById(id); if (child) { result << child; } } return result; }