summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmlitemnode.h1
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmlmodelnodefacade.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmlobjectnode.h3
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp7
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlmodelnodefacade.cpp9
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp11
6 files changed, 31 insertions, 2 deletions
diff --git a/src/plugins/qmldesigner/designercore/include/qmlitemnode.h b/src/plugins/qmldesigner/designercore/include/qmlitemnode.h
index cebb50b590..745fa80ec9 100644
--- a/src/plugins/qmldesigner/designercore/include/qmlitemnode.h
+++ b/src/plugins/qmldesigner/designercore/include/qmlitemnode.h
@@ -51,6 +51,7 @@ public:
QmlItemNode() : QmlObjectNode() {}
QmlItemNode(const ModelNode &modelNode) : QmlObjectNode(modelNode) {}
bool isValid() const;
+ static bool isValidQmlItemNode(const ModelNode &modelNode);
bool isRootNode() const;
static bool isItemOrWindow(const ModelNode &modelNode);
diff --git a/src/plugins/qmldesigner/designercore/include/qmlmodelnodefacade.h b/src/plugins/qmldesigner/designercore/include/qmlmodelnodefacade.h
index 61d67f19fc..56b0742676 100644
--- a/src/plugins/qmldesigner/designercore/include/qmlmodelnodefacade.h
+++ b/src/plugins/qmldesigner/designercore/include/qmlmodelnodefacade.h
@@ -43,6 +43,7 @@ public:
operator ModelNode() const;
ModelNode modelNode();
const ModelNode modelNode() const;
+ static bool isValidQmlModelNodeFacade(const ModelNode &modelNode);
virtual bool isValid() const;
virtual ~QmlModelNodeFacade();
QmlModelNodeFacade();
@@ -50,6 +51,7 @@ public:
bool isRootNode() const;
QmlModelView* qmlModelView() const;
+
protected:
QmlModelNodeFacade(const ModelNode &modelNode);
diff --git a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h
index 3f6a2260f0..0467c60487 100644
--- a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h
+++ b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h
@@ -48,6 +48,9 @@ public:
QmlObjectNode();
QmlObjectNode(const ModelNode &modelNode);
+ static bool isValidQmlObjectNode(const ModelNode &modelNode);
+ bool isValid() const;
+
bool hasNodeParent() const;
bool hasInstanceParent() const;
bool hasInstanceParentItem() const;
diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
index 0da7a5445c..5dea379193 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
@@ -50,7 +50,12 @@ bool QmlItemNode::isItemOrWindow(const ModelNode &modelNode)
bool QmlItemNode::isValid() const
{
- return QmlModelNodeFacade::isValid() && modelNode().metaInfo().isValid() && isItemOrWindow(modelNode());
+ return isValidQmlItemNode(modelNode());
+}
+
+bool QmlItemNode::isValidQmlItemNode(const ModelNode &modelNode)
+{
+ return isValidQmlObjectNode(modelNode) && modelNode.metaInfo().isValid() && isItemOrWindow(modelNode);
}
bool QmlItemNode::isRootNode() const
diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelnodefacade.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelnodefacade.cpp
index 33770cbed7..994afb60c9 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlmodelnodefacade.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlmodelnodefacade.cpp
@@ -59,7 +59,7 @@ const ModelNode QmlModelNodeFacade::modelNode() const
bool QmlModelNodeFacade::isValid() const
{
- return modelNode().isValid() && qmlModelView() && qmlModelView()->nodeInstanceView() && qmlModelView()->hasInstanceForModelNode(modelNode()) && qmlModelView()->instanceForModelNode(modelNode()).isValid();
+ return isValidQmlModelNodeFacade(m_modelNode);
}
QmlModelView* QmlModelNodeFacade::qmlModelView() const
@@ -67,6 +67,13 @@ QmlModelView* QmlModelNodeFacade::qmlModelView() const
return modelNode().view()->toQmlModelView();
}
+bool QmlModelNodeFacade::isValidQmlModelNodeFacade(const ModelNode &modelNode)
+{
+ QmlModelView * qmlModelView = modelNode.view()->toQmlModelView();
+
+ return modelNode.isValid() && qmlModelView && qmlModelView->nodeInstanceView() && qmlModelView->hasInstanceForModelNode(modelNode) && qmlModelView->instanceForModelNode(modelNode).isValid();
+}
+
bool QmlModelNodeFacade::isRootNode() const
{
return modelNode().isRootNode();
diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp
index 564e77cd69..c5d76c3a78 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp
@@ -458,6 +458,17 @@ QmlObjectNode::QmlObjectNode(const ModelNode &modelNode)
: QmlModelNodeFacade(modelNode)
{
}
+
+bool QmlObjectNode::isValidQmlObjectNode(const ModelNode &modelNode)
+{
+ return isValidQmlModelNodeFacade(modelNode);
+}
+
+bool QmlObjectNode::isValid() const
+{
+ return isValidQmlObjectNode(modelNode());
+}
+
bool QmlObjectNode::hasNodeParent() const
{
return modelNode().hasParentProperty();