QmlDesigner.instances: allow fallback to item

If we know from the (text editor) meta system that an object is an
(visible) item, we always create an item as fallback.

We might not be able to instaciate the original item.

Change-Id: I6851cd7a8de68d9d09b789927c204f0617017de7
Reviewed-on: http://codereview.qt.nokia.com/829
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Marco Bubke <marco.bubke@nokia.com>
This commit is contained in:
Thomas Hartmann
2011-06-28 13:24:18 +02:00
committed by Marco Bubke
parent 5d87d4c49b
commit 08e4b339f1
4 changed files with 37 additions and 5 deletions

View File

@@ -218,6 +218,13 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
object = Internal::ObjectNodeInstance::createPrimitive(instanceContainer.type(), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
}
if ((object == 0) && (instanceContainer.metaType() == InstanceContainer::ItemMetaType)) //If we cannot instanciate the object but we know it has to be an Ttem, we create an Item instead.
#if QT_VERSION >= 0x050000
object = Internal::ObjectNodeInstance::createPrimitive("QSGItem", 2, 0, nodeInstanceServer->context())
#else
object = Internal::ObjectNodeInstance::createPrimitive("QDeclarativeItem", 2, 0, nodeInstanceServer->context());
#endif
ServerNodeInstance instance(createInstance(object));
instance.internalInstance()->setNodeInstanceServer(nodeInstanceServer);