void ObjectNodeInstance::reparent(const NodeInstance &oldParentInstance, const QString &oldParentProperty, const NodeInstance &newParentInstance, const QString &newParentProperty)
{
    if (oldParentInstance.isValid()) {
        if (oldParentInstance.isQmlGraphicsItem() && isChildrenProperty(oldParentProperty))
            specialRemoveParentForQmlGraphicsItemChildren(object());
        else
            removeFromOldProperty(object(), oldParentInstance.internalObject(), oldParentProperty);
    }

    if (newParentInstance.isValid()) {
        if (newParentInstance.isQmlGraphicsItem() && isChildrenProperty(newParentProperty))
            specialSetParentForQmlGraphicsItemChildren(object(), qobject_cast<QDeclarativeItem*>(newParentInstance.internalObject()));
        else
            addToNewProperty(object(), newParentInstance.internalObject(), newParentProperty);
    }

    refreshBindings(context()->engine()->rootContext());
}
示例#2
0
void NodeInstanceView::currentStateChanged(const ModelNode &node)
{
    NodeInstance newStateInstance = instanceForModelNode(node);

    if (newStateInstance.isValid() && node.metaInfo().isSubclassOf("QtQuick.State", 1, 0))
        nodeInstanceView()->activateState(newStateInstance);
    else
        nodeInstanceView()->activateBaseState();
}