forked from qt-creator/qt-creator
QmlDesigner: Add QmlItemNode::isInLayout()
Change-Id: I3823c000599db2b1ed326463d4310c94b96f5466 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
d3992542b3
commit
749e5a00b1
@@ -125,6 +125,7 @@ public:
|
||||
void setPostionInBaseState(const QPointF &position);
|
||||
|
||||
void setSize(const QSizeF &size);
|
||||
bool isInLayout() const;
|
||||
};
|
||||
|
||||
QMLDESIGNERCORE_EXPORT uint qHash(const QmlItemNode &node);
|
||||
|
@@ -597,6 +597,19 @@ void QmlItemNode::setPostionInBaseState(const QPointF &position)
|
||||
modelNode().variantProperty("y").setValue(qRound(position.y()));
|
||||
}
|
||||
|
||||
bool QmlItemNode::isInLayout() const
|
||||
{
|
||||
if (isValid() && hasNodeParent()) {
|
||||
|
||||
ModelNode parent = modelNode().parentProperty().parentModelNode();
|
||||
|
||||
if (parent.isValid() && parent.metaInfo().isValid())
|
||||
return parent.metaInfo().isSubclassOf("QtQuick.Layouts.Layout", -1, -1);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QmlItemNode::setSize(const QSizeF &size)
|
||||
{
|
||||
if (!hasBindingProperty("width") && !anchors().instanceHasAnchor(AnchorLineRight))
|
||||
|
Reference in New Issue
Block a user