summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmlmodelview.h2
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmlstate.h2
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp14
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlstate.cpp14
5 files changed, 16 insertions, 18 deletions
diff --git a/src/plugins/qmldesigner/designercore/include/qmlmodelview.h b/src/plugins/qmldesigner/designercore/include/qmlmodelview.h
index d0834644cd..c232997ea3 100644
--- a/src/plugins/qmldesigner/designercore/include/qmlmodelview.h
+++ b/src/plugins/qmldesigner/designercore/include/qmlmodelview.h
@@ -56,8 +56,6 @@ public:
QmlModelState baseState() const;
QmlModelStateGroup rootStateGroup() const;
- ModelNode createQmlState(const PropertyListType &propertyList = PropertyListType());
-
QmlItemNode rootQmlItemNode() const;
protected:
diff --git a/src/plugins/qmldesigner/designercore/include/qmlstate.h b/src/plugins/qmldesigner/designercore/include/qmlstate.h
index 89075c6520..a92078f9c3 100644
--- a/src/plugins/qmldesigner/designercore/include/qmlstate.h
+++ b/src/plugins/qmldesigner/designercore/include/qmlstate.h
@@ -72,6 +72,8 @@ public:
QmlModelState duplicate(const QString &name) const;
QmlModelStateGroup stateGroup() const;
+ static ModelNode createQmlState(AbstractView *view, const PropertyListType &propertyList);
+
protected:
void addChangeSetIfNotExists(const ModelNode &node);
static QmlModelState createBaseState(const QmlModelView *view);
diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
index fd1e2c67ae..44ff287142 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
@@ -506,7 +506,7 @@ QmlModelState QmlModelStateGroup::addState(const QString &name)
PropertyListType propertyList;
propertyList.append(qMakePair(PropertyName("name"), QVariant(name)));
- ModelNode newState = QmlObjectNode(modelNode()).qmlModelView()->createQmlState(propertyList);
+ ModelNode newState = QmlModelState::createQmlState(modelNode().view(), propertyList);
modelNode().nodeListProperty("states").reparentHere(newState);
return newState;
diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
index 14189db308..9aab6e9a57 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
@@ -47,7 +47,7 @@
#include "modelmerger.h"
#include "nodemetainfo.h"
-#include <utils/qtcassert.h>
+
namespace QmlDesigner {
@@ -95,16 +95,4 @@ bool QmlModelView::hasInstanceForModelNode(const ModelNode &modelNode)
return nodeInstanceView() && nodeInstanceView()->hasInstanceForNode(modelNode);
}
-ModelNode QmlModelView::createQmlState(const QmlDesigner::PropertyListType &propertyList)
-{
-
- QTC_CHECK(majorQtQuickVersion() < 3);
-
- if (majorQtQuickVersion() > 1)
- return createModelNode("QtQuick.State", 2, 0, propertyList);
- else
- return createModelNode("QtQuick.State", 1, 0, propertyList);
-}
-
-
} //QmlDesigner
diff --git a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp
index 406c84f795..8f7f4bef78 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp
@@ -35,6 +35,7 @@
#include <invalidmodelnodeexception.h>
#include "bindingproperty.h"
+#include <utils/qtcassert.h>
namespace QmlDesigner {
@@ -294,8 +295,7 @@ QmlModelState QmlModelState::duplicate(const QString &name) const
// QmlModelState newState(stateGroup().addState(name));
PropertyListType propertyList;
propertyList.append(qMakePair(PropertyName("name"), QVariant(name)));
- QmlModelState newState ( qmlModelView()->createQmlState(propertyList) );
-
+ QmlModelState newState(createQmlState(qmlModelView(), propertyList));
foreach (const ModelNode &childNode, modelNode().nodeListProperty("changes").toModelNodeList()) {
ModelNode newModelNode(qmlModelView()->createModelNode(childNode.type(), childNode.majorVersion(), childNode.minorVersion()));
foreach (const BindingProperty &bindingProperty, childNode.bindingProperties())
@@ -316,6 +316,16 @@ QmlModelStateGroup QmlModelState::stateGroup() const
return parentNode.states();
}
+ModelNode QmlModelState::createQmlState(AbstractView *view, const PropertyListType &propertyList)
+{
+ QTC_CHECK(view->majorQtQuickVersion() < 3);
+
+ if (view->majorQtQuickVersion() > 1)
+ return view->createModelNode("QtQuick.State", 2, 0, propertyList);
+ else
+ return view->createModelNode("QtQuick.State", 1, 0, propertyList);
+}
+
QmlModelState QmlModelState::createBaseState(const QmlModelView *view)
{
QmlModelState fxState(view->rootModelNode());