Commit 09d0f777 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.PropertyEditor: crash fix

The method parentProperty() throws an exception instead of
an invalid ModelNode().

Change-Id: I56ce782338cf66ab81b660905f48fe433ca4e843
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 3991379f
......@@ -76,7 +76,11 @@ void QmlAnchorBindingProxy::setup(const QmlItemNode &fxItemNode)
{
m_qmlItemNode = fxItemNode;
m_verticalTarget = m_horizontalTarget = m_topTarget = m_bottomTarget = m_leftTarget = m_rightTarget = m_qmlItemNode.modelNode().parentProperty().parentModelNode();
if (m_qmlItemNode.modelNode().hasParentProperty()) {
setDefaultAnchorTarget(m_qmlItemNode.modelNode().parentProperty().parentModelNode());
} else {
setDefaultAnchorTarget(ModelNode());
}
if (topAnchored()) {
ModelNode targetNode = m_qmlItemNode.anchors().instanceAnchor(AnchorLine::Top).qmlItemNode();
......@@ -662,6 +666,16 @@ void QmlAnchorBindingProxy::fill()
emit anchorsChanged();
}
void QmlAnchorBindingProxy::setDefaultAnchorTarget(const ModelNode &modelNode)
{
m_verticalTarget = modelNode;
m_horizontalTarget = modelNode;
m_topTarget = modelNode;
m_bottomTarget = modelNode;
m_leftTarget = modelNode;
m_rightTarget = modelNode;
}
} // namespace Internal
} // namespace QmlDesigner
......@@ -143,7 +143,7 @@ signals:
void horizontalTargetChanged();
private:
void setDefaultAnchorTarget(const ModelNode &modelNode);
void calcTopMargin();
void calcBottomMargin();
void calcLeftMargin();
......
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