forked from qt-creator/qt-creator
QmlDesigner.Model: Fix isComponent for Loader
Loader was also interpreted as a component, but the handling of component and sourceComponent was incorrect. Change-Id: I5cd691ece1a29c77b52dc74785013f08d589b2eb Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
@@ -1061,9 +1061,27 @@ bool ModelNode::isComponent() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (metaInfo().isSubclassOf("QtQuick.Loader", -1 , -1)) {
|
if (metaInfo().isSubclassOf("QtQuick.Loader", -1 , -1)) {
|
||||||
if (hasNodeProperty("component")
|
|
||||||
&& nodeProperty("component").modelNode().nodeSourceType() == ModelNode::NodeWithComponentSource)
|
if (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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ModelNode componentNode = nodeListProperty("component").toModelNodeList().first();
|
||||||
|
if (componentNode.nodeSourceType() == ModelNode::NodeWithComponentSource)
|
||||||
return true;
|
return true;
|
||||||
|
if (componentNode.metaInfo().isFileComponent())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasNodeProperty("sourceComponent")) {
|
||||||
|
if (nodeProperty("sourceComponent").modelNode().nodeSourceType() == ModelNode::NodeWithComponentSource)
|
||||||
|
return true;
|
||||||
|
if (nodeProperty("sourceComponent").modelNode().metaInfo().isFileComponent())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasVariantProperty("source"))
|
if (hasVariantProperty("source"))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user