summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@digia.com>2013-07-24 15:58:51 +0200
committerMarco Bubke <marco.bubke@digia.com>2013-07-24 16:25:52 +0200
commit599b72a24af300ff8af7836566ceb72be01db9ea (patch)
tree634caf88e3fba0fd5b948ae068369685351630e6
parent07147a328302de9d53f2a6f07cdc788b8929fd7b (diff)
downloadqt-creator-599b72a24af300ff8af7836566ceb72be01db9ea.tar.gz
QmlDesigner: Use is valid functons instead of create a invalid node
Change-Id: I5f7cdcede593cdce2c577315ccead95e8841870e Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.cpp22
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorview.cpp10
-rw-r--r--src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp10
-rw-r--r--src/plugins/qmldesigner/components/integration/componentview.cpp5
-rw-r--r--src/plugins/qmldesigner/components/integration/designdocument.cpp6
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp4
-rw-r--r--src/plugins/qmldesigner/components/navigator/navigatorview.cpp8
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp102
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp12
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp216
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.h4
-rw-r--r--src/plugins/qmldesigner/designercore/include/qmlstate.h2
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp21
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp10
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp33
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlstate.cpp32
16 files changed, 253 insertions, 244 deletions
diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.cpp
index 3c7d299556..5f2448ab2e 100644
--- a/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodecontextmenu_helper.cpp
@@ -53,7 +53,7 @@ static inline bool checkIfNodeIsAView(const ModelNode &node)
static inline void getProperties(const ModelNode node, QHash<PropertyName, QVariant> &propertyHash)
{
- if (QmlObjectNode(node).isValid()) {
+ if (QmlObjectNode::isValidQmlObjectNode(node)) {
foreach (const PropertyName &propertyName, node.propertyNames()) {
if (node.property(propertyName).isVariantProperty() ||
(node.property(propertyName).isBindingProperty() &&
@@ -61,15 +61,17 @@ static inline void getProperties(const ModelNode node, QHash<PropertyName, QVari
propertyHash.insert(propertyName, QmlObjectNode(node).instanceValue(propertyName));
}
}
- }
- QmlItemNode itemNode(node);
- if (itemNode.isValid()) {
- propertyHash.insert("width", itemNode.instanceValue("width"));
- propertyHash.insert("height", itemNode.instanceValue("height"));
- propertyHash.remove("x");
- propertyHash.remove("y");
- propertyHash.remove("rotation");
- propertyHash.remove("opacity");
+
+ if (QmlItemNode::isValidQmlItemNode(node)) {
+ QmlItemNode itemNode(node);
+
+ propertyHash.insert("width", itemNode.instanceValue("width"));
+ propertyHash.insert("height", itemNode.instanceValue("height"));
+ propertyHash.remove("x");
+ propertyHash.remove("y");
+ propertyHash.remove("rotation");
+ propertyHash.remove("opacity");
+ }
}
}
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
index b7991dacde..56709a89aa 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
@@ -104,8 +104,8 @@ void FormEditorView::modelAttached(Model *model)
Q_ASSERT(m_scene->formLayerItem());
- if (rootQmlObjectNode().toQmlItemNode().isValid())
- setupFormEditorItemTree(rootQmlObjectNode().toQmlItemNode());
+ if (QmlItemNode::isValidQmlItemNode(rootModelNode()))
+ setupFormEditorItemTree(rootModelNode());
m_formEditorWidget->updateActions();
}
@@ -159,7 +159,7 @@ void FormEditorView::nodeCreated(const ModelNode &createdNode)
QmlModelView::nodeCreated(createdNode);
ModelNode node(createdNode);
//If the node has source for components/custom parsers we ignore it.
- if (QmlItemNode(node).isValid() && node.nodeSourceType() == ModelNode::NodeWithoutSource) //only setup QmlItems
+ if (QmlItemNode::isValidQmlItemNode(node) && node.nodeSourceType() == ModelNode::NodeWithoutSource) //only setup QmlItems
setupFormEditorItemTree(QmlItemNode(node));
}
@@ -648,8 +648,8 @@ void FormEditorView::delayedReset()
m_resizeTool->clear();
m_dragTool->clear();
m_scene->clearFormEditorItems();
- if (rootQmlObjectNode().toQmlItemNode().isValid())
- setupFormEditorItemTree(rootQmlObjectNode().toQmlItemNode());
+ if (QmlItemNode::isValidQmlItemNode(rootModelNode()))
+ setupFormEditorItemTree(rootModelNode());
}
diff --git a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp
index 1888d5ee1b..01b4b697c9 100644
--- a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp
@@ -347,12 +347,12 @@ void MoveManipulator::reparentTo(FormEditorItem *newParent)
QVector<ModelNode> nodeReparentVector;
NodeAbstractProperty parentProperty;
- QmlItemNode parent(newParent->qmlItemNode());
- if (parent.isValid()) {
- if (parent.hasDefaultProperty())
- parentProperty = parent.nodeAbstractProperty(parent.defaultProperty());
+ QmlItemNode parentItemNode(newParent->qmlItemNode());
+ if (parentItemNode.isValid()) {
+ if (parentItemNode.hasDefaultProperty())
+ parentProperty = parentItemNode.nodeAbstractProperty(parentItemNode.defaultProperty());
else
- parentProperty = parent.nodeAbstractProperty("data");
+ parentProperty = parentItemNode.nodeAbstractProperty("data");
foreach (FormEditorItem* item, m_itemList) {
if (!item || !item->qmlItemNode().isValid())
diff --git a/src/plugins/qmldesigner/components/integration/componentview.cpp b/src/plugins/qmldesigner/components/integration/componentview.cpp
index 346d31b7b9..d84120101b 100644
--- a/src/plugins/qmldesigner/components/integration/componentview.cpp
+++ b/src/plugins/qmldesigner/components/integration/componentview.cpp
@@ -139,8 +139,9 @@ void ComponentView::searchForComponentAndAddToList(const ModelNode &node)
m_standardItemModel->appendRow(item);
} else {
QString description;
- ModelNode parentNode = node.parentProperty().parentModelNode();
- if (parentNode.isValid()) {
+ if (node.hasParentProperty()) {
+ ModelNode parentNode = node.parentProperty().parentModelNode();
+
if (parentNode.id().isEmpty())
description = parentNode.simplifiedTypeName() + QLatin1Char(' ');
else
diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp
index 56dfdda577..2ec03b4d23 100644
--- a/src/plugins/qmldesigner/components/integration/designdocument.cpp
+++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp
@@ -379,7 +379,7 @@ void DesignDocument::deleteSelected()
RewriterTransaction transaction(rewriterView());
QList<ModelNode> toDelete = qmlModelView()->selectedModelNodes();
foreach (ModelNode node, toDelete) {
- if (node.isValid() && !node.isRootNode() && QmlObjectNode(node).isValid())
+ if (node.isValid() && !node.isRootNode() && QmlObjectNode::isValidQmlObjectNode(node))
QmlObjectNode(node).destroy();
}
@@ -562,7 +562,7 @@ void DesignDocument::paste()
if (!targetNode.isValid())
targetNode = view.rootModelNode();
- if (targetNode.parentProperty().isValid() &&
+ if (targetNode.hasParentProperty() &&
(pastedNode.simplifiedTypeName() == targetNode.simplifiedTypeName()) &&
(pastedNode.variantProperty("width").value() == targetNode.variantProperty("width").value()) &&
(pastedNode.variantProperty("height").value() == targetNode.variantProperty("height").value()))
@@ -572,7 +572,7 @@ void DesignDocument::paste()
PropertyName defaultProperty(targetNode.metaInfo().defaultPropertyName());
scatterItem(pastedNode, targetNode);
- if (targetNode.nodeListProperty(defaultProperty).isValid())
+ if (targetNode.hasNodeListProperty(defaultProperty))
targetNode.nodeListProperty(defaultProperty).reparentHere(pastedNode);
transaction.commit();
diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
index b1821e88d9..20e27437dc 100644
--- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
+++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
@@ -47,8 +47,8 @@
static inline void setScenePos(const QmlDesigner::ModelNode &modelNode,const QPointF &pos)
{
- QmlDesigner::QmlItemNode parentNode = modelNode.parentProperty().parentQmlObjectNode().toQmlItemNode();
- if (parentNode.isValid()) {
+ if (modelNode.hasParentProperty() && QmlDesigner::QmlItemNode::isValidQmlItemNode(modelNode.parentProperty().parentModelNode())) {
+ QmlDesigner::QmlItemNode parentNode = modelNode.parentProperty().parentQmlObjectNode().toQmlItemNode();
QPointF localPos = parentNode.instanceSceneTransform().inverted().map(pos);
modelNode.variantProperty("x") = localPos.toPoint().x();
modelNode.variantProperty("y") = localPos.toPoint().y();
diff --git a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp
index deec645b3e..ffa6fe0d2b 100644
--- a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp
+++ b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp
@@ -42,8 +42,8 @@
static inline void setScenePos(const QmlDesigner::ModelNode &modelNode,const QPointF &pos)
{
- QmlDesigner::QmlItemNode parentNode = modelNode.parentProperty().parentQmlObjectNode().toQmlItemNode();
- if (parentNode.isValid()) {
+ if (modelNode.hasParentProperty() && QmlDesigner::QmlItemNode::isValidQmlItemNode(modelNode.parentProperty().parentModelNode())) {
+ QmlDesigner::QmlItemNode parentNode = modelNode.parentProperty().parentQmlObjectNode().toQmlItemNode();
QPointF localPos = parentNode.instanceSceneTransform().inverted().map(pos);
modelNode.variantProperty("x") = localPos.toPoint().x();
modelNode.variantProperty("y") = localPos.toPoint().y();
@@ -303,7 +303,7 @@ void NavigatorView::leftButtonClicked()
foreach (const ModelNode &node, selectedModelNodes()) {
if (!node.isRootNode() && !node.parentProperty().parentModelNode().isRootNode()) {
- if (QmlItemNode(node).isValid()) {
+ if (QmlItemNode::isValidQmlItemNode(node)) {
QPointF scenePos = QmlItemNode(node).instanceScenePosition();
node.parentProperty().parentModelNode().parentProperty().reparentHere(node);
if (!scenePos.isNull())
@@ -330,7 +330,7 @@ void NavigatorView::rightButtonClicked()
if (index >= 0) { //for the first node the semantics are not clear enough. Wrapping would be irritating.
ModelNode newParent = node.parentProperty().toNodeListProperty().at(index);
- if (QmlItemNode(node).isValid()) {
+ if (QmlItemNode::isValidQmlItemNode(node)) {
QPointF scenePos = QmlItemNode(node).instanceScenePosition();
newParent.nodeAbstractProperty(newParent.metaInfo().defaultPropertyName()).reparentHere(node);
if (!scenePos.isNull())
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
index 93d4e3035e..d041b22072 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
@@ -184,7 +184,7 @@ void setupPropertyEditorValue(const PropertyName &name, QDeclarativePropertyMap
}
-void createPropertyEditorValue(const QmlObjectNode &fxObjectNode, const PropertyName &name, const QVariant &value, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor)
+void createPropertyEditorValue(const QmlObjectNode &qmlObjectNode, const PropertyName &name, const QVariant &value, QDeclarativePropertyMap *propertyMap, PropertyEditor *propertyEditor)
{
PropertyName propertyName(name);
propertyName.replace('.', '_');
@@ -196,55 +196,55 @@ void createPropertyEditorValue(const QmlObjectNode &fxObjectNode, const Property
propertyMap->insert(QString::fromUtf8(propertyName), QVariant::fromValue(valueObject));
}
valueObject->setName(name);
- valueObject->setModelNode(fxObjectNode);
+ valueObject->setModelNode(qmlObjectNode);
- if (fxObjectNode.propertyAffectedByCurrentState(name) && !(fxObjectNode.modelNode().property(name).isBindingProperty()))
- valueObject->setValue(fxObjectNode.modelValue(name));
+ if (qmlObjectNode.propertyAffectedByCurrentState(name) && !(qmlObjectNode.modelNode().property(name).isBindingProperty()))
+ valueObject->setValue(qmlObjectNode.modelValue(name));
else
valueObject->setValue(value);
if (propertyName != "id" &&
- fxObjectNode.currentState().isBaseState() &&
- fxObjectNode.modelNode().property(propertyName).isBindingProperty()) {
- valueObject->setExpression(fxObjectNode.modelNode().bindingProperty(propertyName).expression());
+ qmlObjectNode.currentState().isBaseState() &&
+ qmlObjectNode.modelNode().property(propertyName).isBindingProperty()) {
+ valueObject->setExpression(qmlObjectNode.modelNode().bindingProperty(propertyName).expression());
} else {
- valueObject->setExpression(fxObjectNode.instanceValue(name).toString());
+ valueObject->setExpression(qmlObjectNode.instanceValue(name).toString());
}
}
-void PropertyEditor::NodeType::setValue(const QmlObjectNode & fxObjectNode, const PropertyName &name, const QVariant &value)
+void PropertyEditor::NodeType::setValue(const QmlObjectNode & qmlObjectNode, const PropertyName &name, const QVariant &value)
{
PropertyName propertyName = name;
propertyName.replace('.', '_');
PropertyEditorValue *propertyValue = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value(propertyName)));
if (propertyValue) {
propertyValue->setValue(value);
- if (!fxObjectNode.hasBindingProperty(name))
+ if (!qmlObjectNode.hasBindingProperty(name))
propertyValue->setExpression(value.toString());
else
- propertyValue->setExpression(fxObjectNode.expression(name));
+ propertyValue->setExpression(qmlObjectNode.expression(name));
}
}
-void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor)
+void PropertyEditor::NodeType::setup(const QmlObjectNode &qmlObjectNode, const QString &stateName, const QUrl &qmlSpecificsFile, PropertyEditor *propertyEditor)
{
- if (!fxObjectNode.isValid())
+ if (!qmlObjectNode.isValid())
return;
QDeclarativeContext *ctxt = m_view->rootContext();
- if (fxObjectNode.isValid()) {
- foreach (const PropertyName &propertyName, fxObjectNode.modelNode().metaInfo().propertyNames())
- createPropertyEditorValue(fxObjectNode, propertyName, fxObjectNode.instanceValue(propertyName), &m_backendValuesPropertyMap, propertyEditor);
+ if (qmlObjectNode.isValid()) {
+ foreach (const PropertyName &propertyName, qmlObjectNode.modelNode().metaInfo().propertyNames())
+ createPropertyEditorValue(qmlObjectNode, propertyName, qmlObjectNode.instanceValue(propertyName), &m_backendValuesPropertyMap, propertyEditor);
// className
PropertyEditorValue *valueObject = qobject_cast<PropertyEditorValue*>(variantToQObject(m_backendValuesPropertyMap.value("className")));
if (!valueObject)
valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
valueObject->setName("className");
- valueObject->setModelNode(fxObjectNode.modelNode());
- valueObject->setValue(fxObjectNode.modelNode().simplifiedTypeName());
+ valueObject->setModelNode(qmlObjectNode.modelNode());
+ valueObject->setValue(qmlObjectNode.modelNode().simplifiedTypeName());
QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
m_backendValuesPropertyMap.insert("className", QVariant::fromValue(valueObject));
@@ -253,12 +253,12 @@ void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QS
if (!valueObject)
valueObject = new PropertyEditorValue(&m_backendValuesPropertyMap);
valueObject->setName("id");
- valueObject->setValue(fxObjectNode.id());
+ valueObject->setValue(qmlObjectNode.id());
QObject::connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_backendValuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
m_backendValuesPropertyMap.insert("id", QVariant::fromValue(valueObject));
// anchors
- m_backendAnchorBinding.setup(QmlItemNode(fxObjectNode.modelNode()));
+ m_backendAnchorBinding.setup(QmlItemNode(qmlObjectNode.modelNode()));
ctxt->setContextProperty("anchorBackend", &m_backendAnchorBinding);
@@ -267,16 +267,16 @@ void PropertyEditor::NodeType::setup(const QmlObjectNode &fxObjectNode, const QS
m_contextObject->setSpecificsUrl(qmlSpecificsFile);
m_contextObject->setStateName(stateName);
- if (!fxObjectNode.isValid())
+ if (!qmlObjectNode.isValid())
return;
- ctxt->setContextProperty("propertyCount", QVariant(fxObjectNode.modelNode().properties().count()));
+ ctxt->setContextProperty("propertyCount", QVariant(qmlObjectNode.modelNode().properties().count()));
- m_contextObject->setIsBaseState(fxObjectNode.isInBaseState());
+ m_contextObject->setIsBaseState(qmlObjectNode.isInBaseState());
m_contextObject->setSelectionChanged(false);
m_contextObject->setSelectionChanged(false);
- NodeMetaInfo metaInfo = fxObjectNode.modelNode().metaInfo();
+ NodeMetaInfo metaInfo = qmlObjectNode.modelNode().metaInfo();
if (metaInfo.isValid()) {
m_contextObject->setMajorVersion(metaInfo.majorVersion());
@@ -473,12 +473,12 @@ void PropertyEditor::changeValue(const QString &name)
if (value ==0)
return;
- QmlObjectNode fxObjectNode(m_selectedNode);
+ QmlObjectNode qmlObjectNode(m_selectedNode);
QVariant castedValue;
- if (fxObjectNode.modelNode().metaInfo().isValid() && fxObjectNode.modelNode().metaInfo().hasProperty(propertyName)) {
- castedValue = fxObjectNode.modelNode().metaInfo().propertyCastedValue(propertyName, value->value());
+ if (qmlObjectNode.modelNode().metaInfo().isValid() && qmlObjectNode.modelNode().metaInfo().hasProperty(propertyName)) {
+ castedValue = qmlObjectNode.modelNode().metaInfo().propertyCastedValue(propertyName, value->value());
} else {
qWarning() << "PropertyEditor:" <<propertyName << "cannot be casted (metainfo)";
return ;
@@ -489,9 +489,9 @@ void PropertyEditor::changeValue(const QString &name)
return ;
}
- if (fxObjectNode.modelNode().metaInfo().isValid() && fxObjectNode.modelNode().metaInfo().hasProperty(propertyName))
- if (fxObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "QUrl"
- || fxObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "url") { //turn absolute local file paths into relative paths
+ if (qmlObjectNode.modelNode().metaInfo().isValid() && qmlObjectNode.modelNode().metaInfo().hasProperty(propertyName))
+ if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "QUrl"
+ || qmlObjectNode.modelNode().metaInfo().propertyTypeName(propertyName) == "url") { //turn absolute local file paths into relative paths
QString filePath = castedValue.toUrl().toString();
if (QFileInfo(filePath).exists() && QFileInfo(filePath).isAbsolute()) {
QDir fileDir(QFileInfo(model()->fileUrl().toLocalFile()).absolutePath());
@@ -508,11 +508,11 @@ void PropertyEditor::changeValue(const QString &name)
try {
if (!value->value().isValid()) { //reset
- fxObjectNode.removeProperty(propertyName);
+ qmlObjectNode.removeProperty(propertyName);
} else {
if (castedValue.isValid() && !castedValue.isNull()) {
m_locked = true;
- fxObjectNode.setVariantProperty(propertyName, castedValue);
+ qmlObjectNode.setVariantProperty(propertyName, castedValue);
m_locked = false;
}
}
@@ -538,38 +538,38 @@ void PropertyEditor::changeExpression(const QString &propertyName)
PropertyName underscoreName(name);
underscoreName.replace('.', '_');
- QmlObjectNode fxObjectNode(m_selectedNode);
+ QmlObjectNode qmlObjectNode(m_selectedNode);
PropertyEditorValue *value = qobject_cast<PropertyEditorValue*>(variantToQObject(m_currentType->m_backendValuesPropertyMap.value(underscoreName)));
- if (fxObjectNode.modelNode().metaInfo().isValid() && fxObjectNode.modelNode().metaInfo().hasProperty(name)) {
- if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == "QColor") {
+ if (qmlObjectNode.modelNode().metaInfo().isValid() && qmlObjectNode.modelNode().metaInfo().hasProperty(name)) {
+ if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(name) == "QColor") {
if (QColor(value->expression().remove('"')).isValid()) {
- fxObjectNode.setVariantProperty(name, QColor(value->expression().remove('"')));
+ qmlObjectNode.setVariantProperty(name, QColor(value->expression().remove('"')));
transaction.commit(); //committing in the try block
return;
}
- } else if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == "bool") {
+ } else if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(name) == "bool") {
if (value->expression().compare("false", Qt::CaseInsensitive) == 0 || value->expression().compare("true", Qt::CaseInsensitive) == 0) {
if (value->expression().compare("true", Qt::CaseInsensitive) == 0)
- fxObjectNode.setVariantProperty(name, true);
+ qmlObjectNode.setVariantProperty(name, true);
else
- fxObjectNode.setVariantProperty(name, false);
+ qmlObjectNode.setVariantProperty(name, false);
transaction.commit(); //committing in the try block
return;
}
- } else if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == "int") {
+ } else if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(name) == "int") {
bool ok;
int intValue = value->expression().toInt(&ok);
if (ok) {
- fxObjectNode.setVariantProperty(name, intValue);
+ qmlObjectNode.setVariantProperty(name, intValue);
transaction.commit(); //committing in the try block
return;
}
- } else if (fxObjectNode.modelNode().metaInfo().propertyTypeName(name) == "qreal") {
+ } else if (qmlObjectNode.modelNode().metaInfo().propertyTypeName(name) == "qreal") {
bool ok;
qreal realValue = value->expression().toFloat(&ok);
if (ok) {
- fxObjectNode.setVariantProperty(name, realValue);
+ qmlObjectNode.setVariantProperty(name, realValue);
transaction.commit(); //committing in the try block
return;
}
@@ -584,8 +584,8 @@ void PropertyEditor::changeExpression(const QString &propertyName)
if (value->expression().isEmpty())
return;
- if (fxObjectNode.expression(name) != value->expression() || !fxObjectNode.propertyAffectedByCurrentState(name))
- fxObjectNode.setBindingProperty(name, value->expression());
+ if (qmlObjectNode.expression(name) != value->expression() || !qmlObjectNode.propertyAffectedByCurrentState(name))
+ qmlObjectNode.setBindingProperty(name, value->expression());
transaction.commit(); //committing in the try block
}
@@ -744,13 +744,13 @@ void PropertyEditor::resetView()
m_stackedWidget->addWidget(type->m_view);
m_typeHash.insert(qmlFile.toString(), type);
- QmlObjectNode fxObjectNode;
+ QmlObjectNode qmlObjectNode;
if (m_selectedNode.isValid()) {
- fxObjectNode = QmlObjectNode(m_selectedNode);
- Q_ASSERT(fxObjectNode.isValid());
+ qmlObjectNode = QmlObjectNode(m_selectedNode);
+ Q_ASSERT(qmlObjectNode.isValid());
}
QDeclarativeContext *ctxt = type->m_view->rootContext();
- type->setup(fxObjectNode, currentState().name(), qmlSpecificsFile, this);
+ type->setup(qmlObjectNode, currentState().name(), qmlSpecificsFile, this);
ctxt->setContextProperty("finishedNotify", QVariant(false));
if (specificQmlData.isEmpty())
type->m_contextObject->setSpecificQmlData(specificQmlData);
@@ -1008,10 +1008,10 @@ void PropertyEditor::instancePropertyChange(const QList<QPair<ModelNode, Propert
}
-void PropertyEditor::setValue(const QmlObjectNode &fxObjectNode, const PropertyName &name, const QVariant &value)
+void PropertyEditor::setValue(const QmlObjectNode &qmlObjectNode, const PropertyName &name, const QVariant &value)
{
m_locked = true;
- m_currentType->setValue(fxObjectNode, name, value);
+ m_currentType->setValue(qmlObjectNode, name, value);
m_locked = false;
}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
index f9bfd721a9..c64d154752 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp
@@ -356,14 +356,14 @@ void PropertyEditorNodeWrapper::changeValue(const QString &propertyName)
if (name.isNull())
return;
if (m_modelNode.isValid()) {
- QmlDesigner::QmlObjectNode fxObjectNode(m_modelNode);
+ QmlDesigner::QmlObjectNode qmlObjectNode(m_modelNode);
PropertyEditorValue *valueObject = qvariant_cast<PropertyEditorValue *>(m_valuesPropertyMap.value(name));
if (valueObject->value().isValid())
- fxObjectNode.setVariantProperty(name, valueObject->value());
+ qmlObjectNode.setVariantProperty(name, valueObject->value());
else
- fxObjectNode.removeProperty(name);
+ qmlObjectNode.removeProperty(name);
}
}
@@ -372,17 +372,17 @@ void PropertyEditorNodeWrapper::setup()
Q_ASSERT(m_editorValue);
Q_ASSERT(m_editorValue->modelNode().isValid());
if ((m_editorValue->modelNode().isValid() && m_modelNode.isValid())) {
- QmlDesigner::QmlObjectNode fxObjectNode(m_modelNode);
+ QmlDesigner::QmlObjectNode qmlObjectNode(m_modelNode);
foreach ( const QString &propertyName, m_valuesPropertyMap.keys())
m_valuesPropertyMap.clear(propertyName);
foreach (QObject *object, m_valuesPropertyMap.children())
delete object;
foreach (const QmlDesigner::PropertyName &propertyName, m_modelNode.metaInfo().propertyNames()) {
- if (fxObjectNode.isValid()) {
+ if (qmlObjectNode.isValid()) {
PropertyEditorValue *valueObject = new PropertyEditorValue(&m_valuesPropertyMap);
valueObject->setName(propertyName);
- valueObject->setValue(fxObjectNode.instanceValue(propertyName));
+ valueObject->setValue(qmlObjectNode.instanceValue(propertyName));
connect(valueObject, SIGNAL(valueChanged(QString,QVariant)), &m_valuesPropertyMap, SIGNAL(valueChanged(QString,QVariant)));
m_valuesPropertyMap.insert(propertyName, QVariant::fromValue(valueObject));
}
diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp
index e4de93c15d..7a3a9315d6 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.cpp
@@ -74,42 +74,42 @@ QmlAnchorBindingProxy::~QmlAnchorBindingProxy()
void QmlAnchorBindingProxy::setup(const QmlItemNode &fxItemNode)
{
- m_fxItemNode = fxItemNode;
+ m_qmlItemNode = fxItemNode;
- m_verticalTarget = m_horizontalTarget = m_topTarget = m_bottomTarget = m_leftTarget = m_rightTarget = m_fxItemNode.modelNode().parentProperty().parentModelNode();
+ m_verticalTarget = m_horizontalTarget = m_topTarget = m_bottomTarget = m_leftTarget = m_rightTarget = m_qmlItemNode.modelNode().parentProperty().parentModelNode();
if (topAnchored()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Top).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Top).qmlItemNode();
if (targetNode.isValid())
m_topTarget = targetNode;
}
if (bottomAnchored()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Bottom).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Bottom).qmlItemNode();
if (targetNode.isValid())
m_bottomTarget = targetNode;
}
if (leftAnchored()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Left).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Left).qmlItemNode();
if (targetNode.isValid())
m_leftTarget = targetNode;
}
if (rightAnchored()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Right).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Right).qmlItemNode();
if (targetNode.isValid())
m_rightTarget = targetNode;
}
if (verticalCentered()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::VerticalCenter).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::VerticalCenter).qmlItemNode();
if (targetNode.isValid())
m_verticalTarget = targetNode;
}
if (horizontalCentered()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::HorizontalCenter).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::HorizontalCenter).qmlItemNode();
if (targetNode.isValid())
m_horizontalTarget = targetNode;
}
@@ -124,7 +124,7 @@ void QmlAnchorBindingProxy::setup(const QmlItemNode &fxItemNode)
emit centeredVChanged();
emit anchorsChanged();
- if (m_fxItemNode.hasNodeParent()) {
+ if (m_qmlItemNode.hasNodeParent()) {
emit itemNodeChanged();
emit topTargetChanged();
emit bottomTargetChanged();
@@ -140,42 +140,42 @@ void QmlAnchorBindingProxy::invalidate(const QmlItemNode &fxItemNode)
if (m_locked)
return;
- m_fxItemNode = fxItemNode;
+ m_qmlItemNode = fxItemNode;
- m_verticalTarget = m_horizontalTarget = m_topTarget = m_bottomTarget = m_leftTarget = m_rightTarget = m_fxItemNode.modelNode().parentProperty().parentModelNode();
+ m_verticalTarget = m_horizontalTarget = m_topTarget = m_bottomTarget = m_leftTarget = m_rightTarget = m_qmlItemNode.modelNode().parentProperty().parentModelNode();
if (topAnchored()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Top).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Top).qmlItemNode();
if (targetNode.isValid())
m_topTarget = targetNode;
}
if (bottomAnchored()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Bottom).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Bottom).qmlItemNode();
if (targetNode.isValid())
m_bottomTarget = targetNode;
}
if (leftAnchored()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Left).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Left).qmlItemNode();
if (targetNode.isValid())
m_leftTarget = targetNode;
}
if (rightAnchored()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::Right).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Right).qmlItemNode();
if (targetNode.isValid())
m_rightTarget = targetNode;
}
if (verticalCentered()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::VerticalCenter).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::VerticalCenter).qmlItemNode();
if (targetNode.isValid())
m_verticalTarget = targetNode;
}
if (horizontalCentered()) {
- ModelNode targetNode = m_fxItemNode.anchors().instanceAnchor(AnchorLine::HorizontalCenter).qmlItemNode();
+ ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::HorizontalCenter).qmlItemNode();
if (targetNode.isValid())
m_horizontalTarget = targetNode;
}
@@ -188,7 +188,7 @@ void QmlAnchorBindingProxy::invalidate(const QmlItemNode &fxItemNode)
emit centeredVChanged();
emit anchorsChanged();
- if (m_fxItemNode.hasNodeParent()) {
+ if (m_qmlItemNode.hasNodeParent()) {
emit itemNodeChanged();
emit topTargetChanged();
emit bottomTargetChanged();
@@ -201,41 +201,41 @@ void QmlAnchorBindingProxy::invalidate(const QmlItemNode &fxItemNode)
bool QmlAnchorBindingProxy::hasParent()
{
- return m_fxItemNode.isValid() && m_fxItemNode.hasNodeParent();
+ return m_qmlItemNode.isValid() && m_qmlItemNode.hasNodeParent();
}
bool QmlAnchorBindingProxy::isFilled()
{
- return m_fxItemNode.isValid() && hasAnchors() && topAnchored() && bottomAnchored() && leftAnchored() && rightAnchored()
- && (m_fxItemNode.instanceValue("anchors.topMargin").toInt() == 0)
- && (m_fxItemNode.instanceValue("anchors.bottomMargin").toInt() == 0)
- && (m_fxItemNode.instanceValue("anchors.leftMargin").toInt() == 0)
- && (m_fxItemNode.instanceValue("anchors.rightMargin").toInt() == 0);
+ return m_qmlItemNode.isValid() && hasAnchors() && topAnchored() && bottomAnchored() && leftAnchored() && rightAnchored()
+ && (m_qmlItemNode.instanceValue("anchors.topMargin").toInt() == 0)
+ && (m_qmlItemNode.instanceValue("anchors.bottomMargin").toInt() == 0)
+ && (m_qmlItemNode.instanceValue("anchors.leftMargin").toInt() == 0)
+ && (m_qmlItemNode.instanceValue("anchors.rightMargin").toInt() == 0);
}
bool QmlAnchorBindingProxy::topAnchored()
{
- return m_fxItemNode.isValid() && m_fxItemNode.anchors().instanceHasAnchor(AnchorLine::Top);
+ return m_qmlItemNode.isValid() && m_qmlItemNode.anchors().instanceHasAnchor(AnchorLine::Top);
}
bool QmlAnchorBindingProxy::bottomAnchored()
{
- return m_fxItemNode.isValid() && m_fxItemNode.anchors().instanceHasAnchor(AnchorLine::Bottom);
+ return m_qmlItemNode.isValid() && m_qmlItemNode.anchors().instanceHasAnchor(AnchorLine::Bottom);
}
bool QmlAnchorBindingProxy::leftAnchored()
{
- return m_fxItemNode.isValid() && m_fxItemNode.anchors().instanceHasAnchor(AnchorLine::Left);
+ return m_qmlItemNode.isValid() && m_qmlItemNode.anchors().instanceHasAnchor(AnchorLine::Left);
}
bool QmlAnchorBindingProxy::rightAnchored()
{
- return m_fxItemNode.isValid() && m_fxItemNode.anchors().instanceHasAnchor(AnchorLine::Right);
+ return m_qmlItemNode.isValid() && m_qmlItemNode.anchors().instanceHasAnchor(AnchorLine::Right);
}
bool QmlAnchorBindingProxy::hasAnchors()
{
- return m_fxItemNode.isValid() && m_fxItemNode.anchors().instanceHasAnchors();
+ return m_qmlItemNode.isValid() && m_qmlItemNode.anchors().instanceHasAnchors();
}
@@ -246,7 +246,7 @@ void QmlAnchorBindingProxy::setTopTarget(const QVariant &target)
if (newTarget == m_topTarget)
return;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
m_topTarget = newTarget;
calcTopMargin();
@@ -262,7 +262,7 @@ void QmlAnchorBindingProxy::setBottomTarget(const QVariant &target)
if (newTarget == m_bottomTarget)
return;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
m_bottomTarget = newTarget;
calcBottomMargin();
@@ -277,7 +277,7 @@ void QmlAnchorBindingProxy::setLeftTarget(const QVariant &target)
if (newTarget == m_leftTarget)
return;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
m_leftTarget = newTarget;
calcLeftMargin();
@@ -292,7 +292,7 @@ void QmlAnchorBindingProxy::setRightTarget(const QVariant &target)
if (newTarget == m_rightTarget)
return;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
m_rightTarget = newTarget;
calcRightMargin();
@@ -307,10 +307,10 @@ void QmlAnchorBindingProxy::setVerticalTarget(const QVariant &target)
if (newTarget == m_verticalTarget)
return;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
m_verticalTarget = newTarget;
- m_fxItemNode.anchors().setAnchor(AnchorLine::VerticalCenter, m_verticalTarget, AnchorLine::VerticalCenter);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::VerticalCenter, m_verticalTarget, AnchorLine::VerticalCenter);
emit verticalTargetChanged();
}
@@ -322,19 +322,19 @@ void QmlAnchorBindingProxy::setHorizontalTarget(const QVariant &target)
if (newTarget == m_horizontalTarget)
return;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
m_horizontalTarget = newTarget;
- m_fxItemNode.anchors().setAnchor(AnchorLine::HorizontalCenter, m_horizontalTarget, AnchorLine::HorizontalCenter);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::HorizontalCenter, m_horizontalTarget, AnchorLine::HorizontalCenter);
emit horizontalTargetChanged();
}
void QmlAnchorBindingProxy::resetLayout() {
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
- m_fxItemNode.anchors().removeAnchors();
- m_fxItemNode.anchors().removeMargins();
+ m_qmlItemNode.anchors().removeAnchors();
+ m_qmlItemNode.anchors().removeMargins();
restoreProperty(modelNode(), "x");
restoreProperty(modelNode(), "y");
@@ -350,13 +350,13 @@ void QmlAnchorBindingProxy::resetLayout() {
void QmlAnchorBindingProxy::setBottomAnchor(bool anchor)
{
- if (!m_fxItemNode.hasNodeParent())
+ if (!m_qmlItemNode.hasNodeParent())
return;
if (bottomAnchored() == anchor)
return;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
if (!anchor) {
removeBottomAnchor();
@@ -373,13 +373,13 @@ void QmlAnchorBindingProxy::setBottomAnchor(bool anchor)
void QmlAnchorBindingProxy::setLeftAnchor(bool anchor)
{
- if (!m_fxItemNode.hasNodeParent())
+ if (!m_qmlItemNode.hasNodeParent())
return;
if (leftAnchored() == anchor)
return;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
if (!anchor) {
removeLeftAnchor();
@@ -397,13 +397,13 @@ void QmlAnchorBindingProxy::setLeftAnchor(bool anchor)
void QmlAnchorBindingProxy::setRightAnchor(bool anchor)
{
- if (!m_fxItemNode.hasNodeParent())
+ if (!m_qmlItemNode.hasNodeParent())
return;
if (rightAnchored() == anchor)
return;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
if (!anchor) {
removeRightAnchor();
@@ -418,10 +418,10 @@ void QmlAnchorBindingProxy::setRightAnchor(bool anchor)
}
QRectF QmlAnchorBindingProxy::parentBoundingBox()
{
- if (m_fxItemNode.hasInstanceParent()) {
- if (m_fxItemNode.instanceParent().toQmlItemNode().instanceContentItemBoundingRect().isValid())
- return m_fxItemNode.instanceParent().toQmlItemNode().instanceContentItemBoundingRect();
- return m_fxItemNode.instanceParent().toQmlItemNode().instanceBoundingRect();
+ if (m_qmlItemNode.hasInstanceParent()) {
+ if (m_qmlItemNode.instanceParentItem().instanceContentItemBoundingRect().isValid())
+ return m_qmlItemNode.instanceParentItem().instanceContentItemBoundingRect();
+ return m_qmlItemNode.instanceParentItem().instanceBoundingRect();
}
return QRect();
@@ -437,21 +437,21 @@ QRectF QmlAnchorBindingProxy::boundingBox(QmlItemNode node)
QRectF QmlAnchorBindingProxy::transformedBoundingBox()
{
- return m_fxItemNode.instanceTransformWithContentTransform().mapRect(m_fxItemNode.instanceBoundingRect());
+ return m_qmlItemNode.instanceTransformWithContentTransform().mapRect(m_qmlItemNode.instanceBoundingRect());
}
void QmlAnchorBindingProxy::calcTopMargin()
{
m_locked = true;
- if (m_topTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
+ if (m_topTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
qreal topMargin = transformedBoundingBox().top() - parentBoundingBox().top();
- m_fxItemNode.anchors().setMargin( AnchorLine::Top, topMargin);
- m_fxItemNode.anchors().setAnchor(AnchorLine::Top, m_topTarget, AnchorLine::Top);
+ m_qmlItemNode.anchors().setMargin( AnchorLine::Top, topMargin);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::Top, m_topTarget, AnchorLine::Top);
} else {
- qreal topMargin = boundingBox(m_fxItemNode).top() - boundingBox(m_topTarget).bottom();
- m_fxItemNode.anchors().setMargin( AnchorLine::Top, topMargin);
- m_fxItemNode.anchors().setAnchor(AnchorLine::Top, m_topTarget, AnchorLine::Bottom);
+ qreal topMargin = boundingBox(m_qmlItemNode).top() - boundingBox(m_topTarget).bottom();
+ m_qmlItemNode.anchors().setMargin( AnchorLine::Top, topMargin);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::Top, m_topTarget, AnchorLine::Bottom);
}
m_locked = false;
@@ -461,14 +461,14 @@ void QmlAnchorBindingProxy::calcBottomMargin()
{
m_locked = true;
- if (m_bottomTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
+ if (m_bottomTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
qreal bottomMargin = parentBoundingBox().bottom() - transformedBoundingBox().bottom();
- m_fxItemNode.anchors().setMargin( AnchorLine::Bottom, bottomMargin);
- m_fxItemNode.anchors().setAnchor(AnchorLine::Bottom, m_bottomTarget, AnchorLine::Bottom);
+ m_qmlItemNode.anchors().setMargin( AnchorLine::Bottom, bottomMargin);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::Bottom, m_bottomTarget, AnchorLine::Bottom);
} else {
- qreal bottomMargin = boundingBox(m_bottomTarget).top()- boundingBox(m_fxItemNode).bottom();
- m_fxItemNode.anchors().setMargin( AnchorLine::Bottom, bottomMargin);
- m_fxItemNode.anchors().setAnchor(AnchorLine::Bottom, m_bottomTarget, AnchorLine::Top);
+ qreal bottomMargin = boundingBox(m_bottomTarget).top()- boundingBox(m_qmlItemNode).bottom();
+ m_qmlItemNode.anchors().setMargin( AnchorLine::Bottom, bottomMargin);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::Bottom, m_bottomTarget, AnchorLine::Top);
}
m_locked = false;
@@ -478,14 +478,14 @@ void QmlAnchorBindingProxy::calcLeftMargin()
{
m_locked = true;
- if (m_leftTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
+ if (m_leftTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
qreal leftMargin = transformedBoundingBox().left() - parentBoundingBox().left();
- m_fxItemNode.anchors().setMargin(AnchorLine::Left, leftMargin);
- m_fxItemNode.anchors().setAnchor(AnchorLine::Left, m_leftTarget, AnchorLine::Left);
+ m_qmlItemNode.anchors().setMargin(AnchorLine::Left, leftMargin);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::Left, m_leftTarget, AnchorLine::Left);
} else {
- qreal leftMargin = boundingBox(m_fxItemNode).left() - boundingBox(m_leftTarget).right();
- m_fxItemNode.anchors().setMargin( AnchorLine::Left, leftMargin);
- m_fxItemNode.anchors().setAnchor(AnchorLine::Left, m_leftTarget, AnchorLine::Right);
+ qreal leftMargin = boundingBox(m_qmlItemNode).left() - boundingBox(m_leftTarget).right();
+ m_qmlItemNode.anchors().setMargin( AnchorLine::Left, leftMargin);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::Left, m_leftTarget, AnchorLine::Right);
}
m_locked = false;
@@ -495,14 +495,14 @@ void QmlAnchorBindingProxy::calcRightMargin()
{
m_locked = true;
- if (m_rightTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
+ if (m_rightTarget.modelNode() == m_qmlItemNode.modelNode().parentProperty().parentModelNode()) {
qreal rightMargin = parentBoundingBox().right() - transformedBoundingBox().right();
- m_fxItemNode.anchors().setMargin( AnchorLine::Right, rightMargin);
- m_fxItemNode.anchors().setAnchor(AnchorLine::Right, m_rightTarget, AnchorLine::Right);
+ m_qmlItemNode.anchors().setMargin( AnchorLine::Right, rightMargin);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::Right, m_rightTarget, AnchorLine::Right);
} else {
- qreal rightMargin = boundingBox(m_rightTarget).left() - boundingBox(m_fxItemNode).right();
- m_fxItemNode.anchors().setMargin( AnchorLine::Right, rightMargin);
- m_fxItemNode.anchors().setAnchor(AnchorLine::Right, m_rightTarget, AnchorLine::Left);
+ qreal rightMargin = boundingBox(m_rightTarget).left() - boundingBox(m_qmlItemNode).right();
+ m_qmlItemNode.anchors().setMargin( AnchorLine::Right, rightMargin);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::Right, m_rightTarget, AnchorLine::Left);
}
m_locked = false;
@@ -510,18 +510,18 @@ void QmlAnchorBindingProxy::calcRightMargin()
ModelNode QmlAnchorBindingProxy::modelNode() const
{
- return m_fxItemNode.modelNode();
+ return m_qmlItemNode.modelNode();
}
void QmlAnchorBindingProxy::setTopAnchor(bool anchor)
{
- if (!m_fxItemNode.hasNodeParent())
+ if (!m_qmlItemNode.hasNodeParent())
return ;
if (topAnchored() == anchor)
return;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
if (!anchor) {
removeTopAnchor();
@@ -537,10 +537,10 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor)
}
void QmlAnchorBindingProxy::removeTopAnchor() {
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
- m_fxItemNode.anchors().removeAnchor(AnchorLine::Top);
- m_fxItemNode.anchors().removeMargin(AnchorLine::Top);
+ m_qmlItemNode.anchors().removeAnchor(AnchorLine::Top);
+ m_qmlItemNode.anchors().removeMargin(AnchorLine::Top);
restoreProperty(modelNode(), "y");
restoreProperty(modelNode(), "height");
@@ -548,37 +548,37 @@ void QmlAnchorBindingProxy::removeTopAnchor() {
}
void QmlAnchorBindingProxy::removeBottomAnchor() {
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
- m_fxItemNode.anchors().removeAnchor(AnchorLine::Bottom);
- m_fxItemNode.anchors().removeMargin(AnchorLine::Bottom);
+ m_qmlItemNode.anchors().removeAnchor(AnchorLine::Bottom);
+ m_qmlItemNode.anchors().removeMargin(AnchorLine::Bottom);
restoreProperty(modelNode(), "height");
}
void QmlAnchorBindingProxy::removeLeftAnchor() {
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
- m_fxItemNode.anchors().removeAnchor(AnchorLine::Left);
- m_fxItemNode.anchors().removeMargin(AnchorLine::Left);
+ m_qmlItemNode.anchors().removeAnchor(AnchorLine::Left);
+ m_qmlItemNode.anchors().removeMargin(AnchorLine::Left);
restoreProperty(modelNode(), "x");
restoreProperty(modelNode(), "width");
}
void QmlAnchorBindingProxy::removeRightAnchor() {
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
- m_fxItemNode.anchors().removeAnchor(AnchorLine::Right);
- m_fxItemNode.anchors().removeMargin(AnchorLine::Right);
+ m_qmlItemNode.anchors().removeAnchor(AnchorLine::Right);
+ m_qmlItemNode.anchors().removeMargin(AnchorLine::Right);
restoreProperty(modelNode(), "width");
}
void QmlAnchorBindingProxy::setVerticalCentered(bool centered)
{
- if (!m_fxItemNode.hasNodeParent())
+ if (!m_qmlItemNode.hasNodeParent())
return ;
if (verticalCentered() == centered)
@@ -586,13 +586,13 @@ void QmlAnchorBindingProxy::setVerticalCentered(bool centered)
m_locked = true;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
if (!centered) {
- m_fxItemNode.anchors().removeAnchor(AnchorLine::VerticalCenter);
- m_fxItemNode.anchors().removeMargin(AnchorLine::VerticalCenter);
+ m_qmlItemNode.anchors().removeAnchor(AnchorLine::VerticalCenter);
+ m_qmlItemNode.anchors().removeMargin(AnchorLine::VerticalCenter);
} else {
- m_fxItemNode.anchors().setAnchor(AnchorLine::VerticalCenter, m_fxItemNode.modelNode().parentProperty().parentModelNode(), AnchorLine::VerticalCenter);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::VerticalCenter, m_qmlItemNode.modelNode().parentProperty().parentModelNode(), AnchorLine::VerticalCenter);
}
m_locked = false;
@@ -602,7 +602,7 @@ void QmlAnchorBindingProxy::setVerticalCentered(bool centered)
void QmlAnchorBindingProxy::setHorizontalCentered(bool centered)
{
- if (!m_fxItemNode.hasNodeParent())
+ if (!m_qmlItemNode.hasNodeParent())
return ;
if (horizontalCentered() == centered)
@@ -610,13 +610,13 @@ void QmlAnchorBindingProxy::setHorizontalCentered(bool centered)
m_locked = true;
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
if (!centered) {
- m_fxItemNode.anchors().removeAnchor(AnchorLine::HorizontalCenter);
- m_fxItemNode.anchors().removeMargin(AnchorLine::HorizontalCenter);
+ m_qmlItemNode.anchors().removeAnchor(AnchorLine::HorizontalCenter);
+ m_qmlItemNode.anchors().removeMargin(AnchorLine::HorizontalCenter);
} else {
- m_fxItemNode.anchors().setAnchor(AnchorLine::HorizontalCenter, m_fxItemNode.modelNode().parentProperty().parentModelNode(), AnchorLine::HorizontalCenter);
+ m_qmlItemNode.anchors().setAnchor(AnchorLine::HorizontalCenter, m_qmlItemNode.modelNode().parentProperty().parentModelNode(), AnchorLine::HorizontalCenter);
}
m_locked = false;
@@ -626,18 +626,18 @@ void QmlAnchorBindingProxy::setHorizontalCentered(bool centered)
bool QmlAnchorBindingProxy::verticalCentered()
{
- return m_fxItemNode.isValid() && m_fxItemNode.anchors().instanceHasAnchor(AnchorLine::VerticalCenter);
+ return m_qmlItemNode.isValid() && m_qmlItemNode.anchors().instanceHasAnchor(AnchorLine::VerticalCenter);
}
bool QmlAnchorBindingProxy::horizontalCentered()
{
- return m_fxItemNode.isValid() && m_fxItemNode.anchors().instanceHasAnchor(AnchorLine::HorizontalCenter);
+ return m_qmlItemNode.isValid() && m_qmlItemNode.anchors().instanceHasAnchor(AnchorLine::HorizontalCenter);
}
void QmlAnchorBindingProxy::fill()
{
- RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
+ RewriterTransaction transaction = m_qmlItemNode.modelNode().view()->beginRewriterTransaction();
backupPropertyAndRemove(modelNode(), "x");
@@ -645,15 +645,15 @@ void QmlAnchorBindingProxy::fill()
backupPropertyAndRemove(modelNode(), "width");
backupPropertyAndRemove(modelNode(), "height");
- m_fxItemNode.anchors().fill();
+ m_qmlItemNode.anchors().fill();
setHorizontalCentered(false);
setVerticalCentered(false);
- m_fxItemNode.anchors().removeMargin(AnchorLine::Right);
- m_fxItemNode.anchors().removeMargin(AnchorLine::Left);
- m_fxItemNode.anchors().removeMargin(AnchorLine::Top);
- m_fxItemNode.anchors().removeMargin(AnchorLine::Bottom);
+ m_qmlItemNode.anchors().removeMargin(AnchorLine::Right);
+ m_qmlItemNode.anchors().removeMargin(AnchorLine::Left);
+ m_qmlItemNode.anchors().removeMargin(AnchorLine::Top);
+ m_qmlItemNode.anchors().removeMargin(AnchorLine::Bottom);
emit topAnchorChanged();
emit bottomAnchorChanged();
diff --git a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.h b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.h
index fe7567c290..e4e6049fdb 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/qmlanchorbindingproxy.h
@@ -92,7 +92,7 @@ public:
bool horizontalCentered();
bool verticalCentered();
- QVariant itemNode() const { return QVariant::fromValue(m_fxItemNode.modelNode()); }
+ QVariant itemNode() const { return QVariant::fromValue(m_qmlItemNode.modelNode()); }
QVariant topTarget() const { return QVariant::fromValue(m_topTarget.modelNode()); }
QVariant bottomTarget() const { return QVariant::fromValue(m_bottomTarget.modelNode()); }
@@ -151,7 +151,7 @@ private:
ModelNode modelNode() const;
- QmlItemNode m_fxItemNode;
+ QmlItemNode m_qmlItemNode;
QRectF parentBoundingBox();
diff --git a/src/plugins/qmldesigner/designercore/include/qmlstate.h b/src/plugins/qmldesigner/designercore/include/qmlstate.h
index 84e358b042..89075c6520 100644
--- a/src/plugins/qmldesigner/designercore/include/qmlstate.h
+++ b/src/plugins/qmldesigner/designercore/include/qmlstate.h
@@ -64,9 +64,11 @@ public:
QString name() const;
void setName(const QString &name);
bool isValid() const;
+ static bool isValidQmlModelState(const ModelNode &modelNode);
void destroy();
bool isBaseState() const;
+ static bool isBaseState(const ModelNode &modelNode);
QmlModelState duplicate(const QString &name) const;
QmlModelStateGroup stateGroup() const;
diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
index 5dea379193..22b6a98b86 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
@@ -72,7 +72,7 @@ QStringList QmlModelStateGroup::names() const
if (modelNode().property("states").isNodeListProperty()) {
foreach (const ModelNode &node, modelNode().nodeListProperty("states").toModelNodeList()) {
- if (QmlModelState(node).isValid())
+ if (QmlModelState::isValidQmlModelState(node))
returnList.append(QmlModelState(node).name());
}
}
@@ -110,7 +110,7 @@ QList<QmlItemNode> QmlItemNode::children() const
}
foreach (const ModelNode &modelNode, modelNodeList) {
- if (QmlItemNode(modelNode).isValid()) //if ModelNode is FxItem
+ if (QmlItemNode::isValidQmlItemNode(modelNode)) //if ModelNode is FxItem
returnList.append(modelNode);
}
}
@@ -134,7 +134,7 @@ QList<QmlObjectNode> QmlItemNode::resources() const
}
foreach (const ModelNode &node, modelNodeList) {
- if (!QmlObjectNode(node).isValid()) //if ModelNode is no FxItem
+ if (!QmlObjectNode::isValidQmlObjectNode(node)) //if ModelNode is no FxItem
returnList.append(node);
}
}
@@ -150,7 +150,7 @@ QList<QmlObjectNode> QmlItemNode::defaultPropertyChildren() const
modelNodeList.append(modelNode().nodeListProperty(defaultProperty()).toModelNodeList());
foreach (const ModelNode &node, modelNodeList) {
- if (!QmlObjectNode(node).isValid()) //if ModelNode is no FxItem
+ if (!QmlObjectNode::isValidQmlObjectNode(node)) //if ModelNode is no FxItem
returnList.append(node);
}
}
@@ -272,11 +272,10 @@ QTransform QmlItemNode::instanceSceneContentItemTransform() const
QPointF QmlItemNode::instanceScenePosition() const
{
- QmlItemNode parentNode = instanceParent().toQmlItemNode();
- if (!parentNode.isValid())
- parentNode = modelNode().parentProperty().parentQmlObjectNode().toQmlItemNode();
- if (parentNode.isValid())
- return parentNode.instanceSceneTransform().map(nodeInstance().position());
+ if (hasInstanceParentItem())
+ return instanceParentItem().instanceSceneTransform().map(nodeInstance().position());
+ else if (modelNode().hasParentProperty() && QmlItemNode::isValidQmlItemNode(modelNode().parentProperty().parentModelNode()))
+ return QmlItemNode(modelNode().parentProperty().parentModelNode()).instanceSceneTransform().map(nodeInstance().position());
return QPointF();
}
@@ -331,8 +330,8 @@ QList<QmlModelState> QmlModelStateGroup::allStates() const
if (modelNode().property("states").isNodeListProperty()) {
foreach (const ModelNode &node, modelNode().nodeListProperty("states").toModelNodeList()) {
- if (QmlModelState(node).isValid())
- returnList.append(QmlModelState(node));
+ if (QmlModelState::isValidQmlModelState(node))
+ returnList.append(node);
}
}
return returnList;
diff --git a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
index d49078aec5..9a2d6be892 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
@@ -58,10 +58,7 @@ QmlModelView::QmlModelView(QObject *parent)
void QmlModelView::setCurrentState(const QmlModelState &state)
{
- if (!state.isValid())
- return;
-
- if (!model())
+ if (!model() && !state.isValid())
return;
if (actualStateNode() != state.modelNode())
@@ -101,10 +98,9 @@ QmlItemNode QmlModelView::createQmlItemNode(const TypeName &typeString,
QmlItemNode QmlModelView::createQmlItemNodeFromImage(const QString &imageName, const QPointF &position, QmlItemNode parentNode)
{
- if (!parentNode.isValid())
+ if (!parentNode.isValid() && rootQmlItemNode().isValid())
parentNode = rootQmlItemNode();
-
- if (!parentNode.isValid())
+ else
return QmlItemNode();
QmlItemNode newNode;
diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp
index c5d76c3a78..2b1cdf054d 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp
@@ -320,19 +320,19 @@ QList<QmlModelStateOperation> QmlObjectNode::allAffectingStatesOperations() cons
return returnList;
}
-static QList<QmlItemNode> allFxItemsRecursive(const QmlItemNode &fxNode)
+static QList<QmlItemNode> allQmlItemsRecursive(const QmlItemNode &qmlItemNode)
{
QList<QmlItemNode> returnList;
- if (fxNode.isValid()) {
- returnList.append(fxNode);
+ if (qmlItemNode.isValid()) {
+ returnList.append(qmlItemNode);
QList<QmlItemNode> allChildNodes;
- foreach (const ModelNode &node, fxNode.modelNode().allDirectSubModelNodes()) {
- if (QmlItemNode(node).isValid())
+ foreach (const ModelNode &node, qmlItemNode.modelNode().allDirectSubModelNodes()) {
+ if (QmlItemNode::isValidQmlItemNode(node))
allChildNodes.append(node);
}
foreach (const QmlItemNode &node, allChildNodes) {
- returnList.append(allFxItemsRecursive(node));
+ returnList.append(allQmlItemsRecursive(node));
}
}
return returnList;
@@ -345,14 +345,12 @@ QList<QmlModelState> QmlObjectNode::allDefinedStates() const
QList<QmlModelState> returnList;
- QList<QmlItemNode> allFxItems;
+ QList<QmlItemNode> allQmlItems;
- QmlItemNode rootNode(qmlModelView()->rootModelNode());
+ if (QmlItemNode::isValidQmlItemNode(qmlModelView()->rootModelNode()))
+ allQmlItems.append(allQmlItemsRecursive(qmlModelView()->rootModelNode()));
- if (rootNode.isValid())
- allFxItems.append(allFxItemsRecursive(rootNode));
-
- foreach (const QmlItemNode &item, allFxItems) {
+ foreach (const QmlItemNode &item, allQmlItems) {
returnList.append(item.states().allStates());
}
@@ -378,12 +376,12 @@ void QmlObjectNode::removeProperty(const PropertyName &name)
}
}
-QList<ModelNode> toModelNodeList(const QList<QmlObjectNode> &fxObjectNodeList)
+QList<ModelNode> toModelNodeList(const QList<QmlObjectNode> &qmlObjectNodeList)
{
QList<ModelNode> modelNodeList;
- foreach (const QmlObjectNode &fxObjectNode, fxObjectNodeList)
- modelNodeList.append(fxObjectNode.modelNode());
+ foreach (const QmlObjectNode &qmlObjectNode, qmlObjectNodeList)
+ modelNodeList.append(qmlObjectNode.modelNode());
return modelNodeList;
}
@@ -393,9 +391,8 @@ QList<QmlObjectNode> toQmlObjectNodeList(const QList<ModelNode> &modelNodeList)
QList<QmlObjectNode> qmlObjectNodeList;
foreach (const ModelNode &modelNode, modelNodeList) {
- QmlObjectNode objectNode(modelNode);
- if (objectNode.isValid())
- qmlObjectNodeList.append(objectNode);
+ if (QmlObjectNode::isValidQmlObjectNode(modelNode))
+ qmlObjectNodeList.append(modelNode);
}
return qmlObjectNodeList;
diff --git a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp
index 21d343a953..2bf4585482 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlstate.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlstate.cpp
@@ -58,7 +58,9 @@ QmlPropertyChanges QmlModelState::propertyChanges(const ModelNode &node)
addChangeSetIfNotExists(node);
foreach (const ModelNode &childNode, modelNode().nodeListProperty("changes").toModelNodeList()) {
//### exception if not valid QmlModelStateOperation
- if (QmlPropertyChanges(childNode).target().isValid() && QmlPropertyChanges(childNode).target() == node && QmlPropertyChanges(childNode).isValid())
+ if (QmlPropertyChanges::isValidQmlPropertyChanges(childNode)
+ && QmlPropertyChanges(childNode).target().isValid()
+ && QmlPropertyChanges(childNode).target() == node)
return QmlPropertyChanges(childNode); //### exception if not valid(childNode);
}
return QmlPropertyChanges(); //not found
@@ -78,14 +80,14 @@ QList<QmlModelStateOperation> QmlModelState::stateOperations(const ModelNode &no
Q_ASSERT(modelNode().property("changes").isNodeListProperty());
foreach (const ModelNode &childNode, modelNode().nodeListProperty("changes").toModelNodeList()) {
- QmlModelStateOperation stateOperation(childNode);
- if (stateOperation.isValid()) {
+ if (QmlModelStateOperation::isValidQmlModelStateOperation(childNode)) {
+ QmlModelStateOperation stateOperation(childNode);
ModelNode targetNode = stateOperation.target();
- if (targetNode.isValid()
- && targetNode == node)
- returnList.append(stateOperation); //### exception if not valid(childNode);
+ if (targetNode.isValid() && targetNode == node)
+ returnList.append(stateOperation); //### exception if not valid(childNode);
}
}
+
return returnList; //not found
}
@@ -246,9 +248,14 @@ void QmlModelState::setName(const QString &name)
bool QmlModelState::isValid() const
{
- return QmlModelNodeFacade::isValid() &&
- modelNode().metaInfo().isValid() &&
- (modelNode().metaInfo().isSubclassOf("QtQuick.State", -1, -1) || isBaseState());
+ return isValidQmlModelState(modelNode());
+}
+
+bool QmlModelState::isValidQmlModelState(const ModelNode &modelNode)
+{
+ return isValidQmlModelNodeFacade(modelNode)
+ && modelNode.metaInfo().isValid()
+ && (modelNode.metaInfo().isSubclassOf("QtQuick.State", -1, -1) || isBaseState(modelNode));
}
/**
@@ -267,7 +274,12 @@ void QmlModelState::destroy()
bool QmlModelState::isBaseState() const
{
- return !modelNode().isValid() || modelNode().isRootNode();
+ return isBaseState(modelNode());
+}
+
+bool QmlModelState::isBaseState(const ModelNode &modelNode)
+{
+ return !modelNode.isValid() || modelNode.isRootNode();
}
QmlModelState QmlModelState::duplicate(const QString &name) const