Commit 8b923839 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.NodeInstances: Use the node instance id member

Use the node instance id member instead of the model node id
Prevents a crash because the model node is allready invalid
and has no id anymore.
parent 9160c806
......@@ -699,9 +699,11 @@ void NodeInstanceView::removeIdFromContext(QObject *object)
{
if (hasInstanceForObject(object)) {
NodeInstance instance = instanceForObject(object);
QString id = instance.modelNode().id();
if (!id.isEmpty())
engine()->rootContext()->setContextProperty(id, 0);
if (instance.internalInstance()) {
QString id = instance.internalInstance()->id();
if (!id.isEmpty())
engine()->rootContext()->setContextProperty(id, 0);
}
}
}
......
......@@ -199,6 +199,11 @@ void ObjectNodeInstance::setId(const QString &id)
m_id = id;
}
QString ObjectNodeInstance::id() const
{
return m_id;
}
bool ObjectNodeInstance::isQmlGraphicsItem() const
{
return false;
......
......@@ -106,6 +106,7 @@ public:
virtual void reparent(const NodeInstance &oldParentInstance, const QString &oldParentProperty, const NodeInstance &newParentInstance, const QString &newParentProperty);
void setId(const QString &id);
QString id() const;
virtual bool isQmlGraphicsItem() const;
virtual bool isGraphicsScene() const;
......
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