static void handleTabComponent(const ModelNode &modelNode) { if (modelNode.hasNodeProperty("component") && modelNode.nodeProperty("component").modelNode().nodeSourceType() == ModelNode::NodeWithComponentSource) { designDocument()->changeToSubComponent(modelNode.nodeProperty("component").modelNode()); } }
static void handleDelegate(const ModelNode &modelNode) { if (modelNode.metaInfo().isView() && modelNode.hasNodeProperty("delegate") && modelNode.nodeProperty("delegate").modelNode().nodeSourceType() == ModelNode::NodeWithComponentSource) designDocument()->changeToSubComponent(modelNode.nodeProperty("delegate").modelNode()); }
static void openComponentSourcePropertyOfLoader(const ModelNode &modelNode) { QmlDesignerPlugin::instance()->viewManager().nextFileIsCalledInternally(); QHash<PropertyName, QVariant> propertyHash; getProperties(modelNode, propertyHash); ModelNode componentModelNode; if (modelNode.hasNodeProperty("sourceComponent")) { componentModelNode = modelNode.nodeProperty("sourceComponent").modelNode(); } else if (modelNode.hasNodeListProperty("component")) { /* * The component property should be a NodeProperty, but currently is a NodeListProperty, because * the default property is always implcitly a NodeListProperty. This is something that has to be fixed. */ componentModelNode = modelNode.nodeListProperty("component").toModelNodeList().first(); } Core::EditorManager::openEditor(componentModelNode.metaInfo().componentFileName(), Core::Id(), Core::EditorManager::DoNotMakeVisible); ModelNode rootModelNode = currentDesignDocument()->rewriterView()->rootModelNode(); applyProperties(rootModelNode, propertyHash); }
static bool hasDelegateWithFileComponent(const ModelNode &node) { if (node.isValid() && node.metaInfo().isValid() && node.metaInfo().isView() && node.hasNodeProperty("delegate") && node.nodeProperty("delegate").modelNode().metaInfo().isFileComponent()) return true; return false; }
static bool isLoaderWithSourceComponent(const ModelNode &modelNode) { if (modelNode.isValid() && modelNode.metaInfo().isValid() && modelNode.metaInfo().isSubclassOf("QtQuick.Loader")) { if (modelNode.hasNodeProperty("sourceComponent")) return true; if (modelNode.hasNodeListProperty("component")) return true; } return false; }
static bool isInEditedPath(const NodeAbstractProperty &propertyParent, const ModelNode &editingPathViewModelNode) { if (editingPathViewModelNode.isValid()) { if (editingPathViewModelNode.hasNodeProperty("path")) { ModelNode pathModelNode = editingPathViewModelNode.nodeProperty("path").modelNode(); if (pathModelNode.metaInfo().isSubclassOf("QtQuick.Path")) { if (propertyParent.name() == "pathElements" && propertyParent.parentModelNode() == pathModelNode) return true; } } } return false; }