Fix id setting in the ObjectNodeInstance

This commit is contained in:
Marco Bubke
2010-01-12 13:36:28 +01:00
parent e31236a08f
commit 23657d2c6f

View File

@@ -152,10 +152,12 @@ void ObjectNodeInstance::setNodeInstance(NodeInstanceView *view)
void ObjectNodeInstance::setId(const QString &id) void ObjectNodeInstance::setId(const QString &id)
{ {
if (!object()->objectName().isEmpty()) {
context()->engine()->rootContext()->setContextProperty(object()->objectName(), 0);
}
if (!id.isEmpty()) { if (!id.isEmpty()) {
context()->engine()->rootContext()->setContextProperty(id, object()); // will also force refresh of all bindings context()->engine()->rootContext()->setContextProperty(id, object()); // will also force refresh of all bindings
} else if (!object()->objectName().isEmpty()) {
context()->engine()->rootContext()->setContextProperty(object()->objectName(), 0);
} }
object()->setObjectName(id); object()->setObjectName(id);