forked from qt-creator/qt-creator
QmlDesigner: Change isPositioner in isLayoutable to catch layouts too
Change-Id: Ic6b68a57095dc94df62278666c4c3cb150eb374e Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
74a2bfb975
commit
d1fa28e7a3
@@ -101,7 +101,7 @@ void MoveManipulator::synchronizeParent(const QList<FormEditorItem*> &itemList,
|
||||
}
|
||||
}
|
||||
|
||||
if (!parentNode.metaInfo().isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1))
|
||||
if (!parentNode.metaInfo().isLayoutable())
|
||||
update(m_lastPosition, Snapper::NoSnapping, UseBaseState);
|
||||
}
|
||||
|
||||
@@ -346,10 +346,10 @@ void MoveManipulator::reparentTo(FormEditorItem *newParent)
|
||||
if (!itemsCanReparented())
|
||||
return;
|
||||
|
||||
if (!newParent->qmlItemNode().modelNode().metaInfo().isPositioner()
|
||||
if (!newParent->qmlItemNode().modelNode().metaInfo().isLayoutable()
|
||||
&& newParent->qmlItemNode().modelNode().hasParentProperty()) {
|
||||
ModelNode grandParent = newParent->qmlItemNode().modelNode().parentProperty().parentModelNode();
|
||||
if (grandParent.metaInfo().isPositioner())
|
||||
if (grandParent.metaInfo().isLayoutable())
|
||||
newParent = m_view.data()->scene()->itemForQmlItemNode(QmlItemNode(grandParent));
|
||||
}
|
||||
|
||||
|
||||
@@ -538,7 +538,7 @@ void NavigatorTreeModel::moveNodesInteractive(NodeAbstractProperty parentPropert
|
||||
}
|
||||
}
|
||||
|
||||
if (parentProperty.isDefaultProperty() && parentProperty.parentModelNode().metaInfo().isPositioner()) {
|
||||
if (parentProperty.isDefaultProperty() && parentProperty.parentModelNode().metaInfo().isLayoutable()) {
|
||||
ModelNode currentNode = node;
|
||||
if (currentNode.hasProperty("x"))
|
||||
currentNode.removeProperty("x");
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
bool availableInVersion(int majorVersion, int minorVersion) const;
|
||||
bool isSubclassOf(const TypeName &type, int majorVersion, int minorVersio) const;
|
||||
|
||||
bool isPositioner() const;
|
||||
bool isLayoutable() const;
|
||||
|
||||
QString importDirectoryPath() const;
|
||||
|
||||
|
||||
@@ -1279,11 +1279,11 @@ void NodeMetaInfo::clearCache()
|
||||
Internal::NodeMetaInfoPrivate::clearCache();
|
||||
}
|
||||
|
||||
bool NodeMetaInfo::isPositioner() const
|
||||
bool NodeMetaInfo::isLayoutable() const
|
||||
{
|
||||
if (majorVersion() < 2)
|
||||
return isSubclassOf("<cpp>.QDeclarativeBasePositioner", -1, -1);
|
||||
return isSubclassOf("QtQuick.Positioner", -1, -1);
|
||||
return isSubclassOf("QtQuick.Positioner", -1, -1) || isSubclassOf("QtQuick.Layouts.Layout", -1, -1);
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
Reference in New Issue
Block a user