Commit 0f66d495 authored by Thomas Hartmann's avatar Thomas Hartmann

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: default avatarMarco Bubke <marco.bubke@digia.com>
parent b9bbadcc
......@@ -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));
}
......
......@@ -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);
}
}
......
......@@ -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:
......
......@@ -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
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment