diff options
author | Thomas Hartmann <Thomas.Hartmann@digia.com> | 2012-09-25 13:03:22 +0200 |
---|---|---|
committer | Thomas Hartmann <Thomas.Hartmann@digia.com> | 2012-09-25 14:38:45 +0200 |
commit | 0f66d495e9642dd7086188e9f50552edb485c535 (patch) | |
tree | d7408f3428316e9ff841f8c8cedefd542a04a549 /src | |
parent | b9bbadcc7a509d884504c1b659b87e664ac0cf1b (diff) | |
download | qt-creator-0f66d495e9642dd7086188e9f50552edb485c535.tar.gz |
QmlDesigner: prepare the Model for QtQuick 2.0
We have to also check for the correct QtQuick 2.0 in a few places.
For Positioner I added a helper function.
Change-Id: Ie692f16d8d9433a0248854a3bc48b846138eff04
Reviewed-by: Marco Bubke <marco.bubke@digia.com>
Diffstat (limited to 'src')
5 files changed, 16 insertions, 5 deletions
diff --git a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp index f629d8da1c..b39f5d345a 100644 --- a/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp +++ b/src/plugins/qmldesigner/components/formeditor/movemanipulator.cpp @@ -363,10 +363,10 @@ void MoveManipulator::reparentTo(FormEditorItem *newParent) if (!itemsCanReparented()) return; - if (!newParent->qmlItemNode().modelNode().metaInfo().isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1) + if (!newParent->qmlItemNode().modelNode().metaInfo().isPositioner() && newParent->qmlItemNode().modelNode().hasParentProperty()) { ModelNode grandParent = newParent->qmlItemNode().modelNode().parentProperty().parentModelNode(); - if (grandParent.metaInfo().isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1)) + if (grandParent.metaInfo().isPositioner()) newParent = m_view.data()->scene()->itemForQmlItemNode(QmlItemNode(grandParent)); } diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index e2d6851c47..3ac27c7ed8 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -546,7 +546,7 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty parentPropert } } - if (parentProperty.isDefaultProperty() && parentProperty.parentModelNode().metaInfo().isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1)) { + if (parentProperty.isDefaultProperty() && parentProperty.parentModelNode().metaInfo().isPositioner()) { ModelNode currentNode = node; if (currentNode.hasProperty("x")) currentNode.removeProperty("x"); @@ -629,7 +629,7 @@ QStringList NavigatorTreeModel::visibleProperties(const ModelNode &node) const QString qmlType = qmlTypeInQtContainer(node.metaInfo().propertyTypeName(propertyName)); if (node.model()->metaInfo(qmlType).isValid() && - node.model()->metaInfo(qmlType).isSubclassOf("<cpp>.QGraphicsObject", -1, -1)) { + node.model()->metaInfo(qmlType).isSubclassOf("QtQuick.Item", -1, -1)) { propertyList.append(propertyName); } } diff --git a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h index 9317f4fd71..f40a95fcc5 100644 --- a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h +++ b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h @@ -98,6 +98,8 @@ public: bool availableInVersion(int majorVersion, int minorVersion) const; bool isSubclassOf(const QString& type, int majorVersion, int minorVersio) const; + bool isPositioner() const; + static void clearCache(); private: diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 8a3e145058..554cc7601c 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -1107,4 +1107,11 @@ void NodeMetaInfo::clearCache() Internal::NodeMetaInfoPrivate::clearCache(); } +bool NodeMetaInfo::isPositioner() const +{ + if (majorVersion() < 2) + return isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1); + return isSubclassOf("QtQuick.Positioner", -1, -1); +} + } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp b/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp index c4a814fa82..ba24210afe 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp @@ -57,7 +57,9 @@ bool QmlPropertyChanges::isValid() const bool QmlModelStateOperation::isValid() const { - return QmlModelNodeFacade::isValid() && modelNode().metaInfo().isSubclassOf("<cpp>.QDeclarative1StateOperation", -1, -1); + return QmlModelNodeFacade::isValid() && ( + modelNode().metaInfo().isSubclassOf("<cpp>.QDeclarative1StateOperation", -1, -1) + || modelNode().metaInfo().isSubclassOf("<cpp>.QDeclarativeStateOperation", -1, -1)); } void QmlPropertyChanges::removeProperty(const QString &name) |