forked from qt-creator/qt-creator
QmlDesigner: Add helper functions to remove transitions
Change-Id: I33c972f9080b5c344e07c3f910e0a36fa981063b Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
committed by
Tim Jenssen
parent
6b6b844020
commit
38bfdd86e3
@@ -144,6 +144,7 @@ public:
|
|||||||
QmlFlowViewNode flowView() const;
|
QmlFlowViewNode flowView() const;
|
||||||
ModelNode findSourceForDecisionNode() const;
|
ModelNode findSourceForDecisionNode() const;
|
||||||
static bool isFlowEditorTarget(const ModelNode &modelNode);
|
static bool isFlowEditorTarget(const ModelNode &modelNode);
|
||||||
|
void removeTransitions();
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMLDESIGNERCORE_EXPORT QmlFlowActionAreaNode : public QmlItemNode
|
class QMLDESIGNERCORE_EXPORT QmlFlowActionAreaNode : public QmlItemNode
|
||||||
@@ -181,6 +182,8 @@ public:
|
|||||||
const QList<ModelNode> wildcards() const;
|
const QList<ModelNode> wildcards() const;
|
||||||
const QList<ModelNode> decicions() const;
|
const QList<ModelNode> decicions() const;
|
||||||
QList<ModelNode> transitionsForTarget(const ModelNode &modelNode);
|
QList<ModelNode> transitionsForTarget(const ModelNode &modelNode);
|
||||||
|
void removeDanglingTransitions();
|
||||||
|
void removeAllTransitions();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -715,6 +715,14 @@ QList<ModelNode> QmlFlowViewNode::transitionsForTarget(const ModelNode &modelNod
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlFlowViewNode::removeDanglingTransitions()
|
||||||
|
{
|
||||||
|
for (const ModelNode &transition : transitions()) {
|
||||||
|
if (!transition.hasBindingProperty("to"))
|
||||||
|
QmlObjectNode(transition).destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool QmlFlowTargetNode::isValid() const
|
bool QmlFlowTargetNode::isValid() const
|
||||||
{
|
{
|
||||||
return isFlowEditorTarget(modelNode());
|
return isFlowEditorTarget(modelNode());
|
||||||
@@ -802,4 +810,24 @@ bool QmlFlowTargetNode::isFlowEditorTarget(const ModelNode &modelNode)
|
|||||||
|| QmlVisualNode::isFlowWildcard(modelNode);
|
|| QmlVisualNode::isFlowWildcard(modelNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlFlowTargetNode::removeTransitions()
|
||||||
|
{
|
||||||
|
if (!modelNode().hasId())
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (const BindingProperty &property : BindingProperty::findAllReferencesTo(modelNode())) {
|
||||||
|
if (property.isValid() && QmlVisualNode::isFlowTransition(property.parentModelNode()))
|
||||||
|
QmlObjectNode(property.parentModelNode()).destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlFlowViewNode::removeAllTransitions()
|
||||||
|
{
|
||||||
|
if (!isValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (hasProperty("flowTransitions"))
|
||||||
|
removeProperty("flowTransitions");
|
||||||
|
}
|
||||||
|
|
||||||
} //QmlDesigner
|
} //QmlDesigner
|
||||||
|
Reference in New Issue
Block a user