QmlDesigner: Add more items to component combobox

It makes sense to also add items that are not in a default properties
to the component comobox.

These are items like styling delegates:

Slider {
    handle: Item {
    }
}

or the items of e.g. a Flipable:

Flipable {
    front: Item {
}

Those items are not shown in the navigator (TODO) and it makes
sense to edit them if they were an inline component.

Change-Id: Iab5b6e0238625b5a486901fbf617911d06a34581
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2016-10-13 11:15:15 +02:00
committed by Tim Jenssen
parent e05cb92cea
commit 5b5aaf9eb3

View File

@@ -191,7 +191,9 @@ void ComponentView::searchForComponentAndAddToList(const ModelNode &node)
bool masterNotAdded = true;
foreach (const ModelNode &node, node.allSubModelNodesAndThisNode()) {
if (node.nodeSourceType() == ModelNode::NodeWithComponentSource) {
if (node.nodeSourceType() == ModelNode::NodeWithComponentSource
|| (node.hasParentProperty()
&& !node.parentProperty().isDefaultProperty())) {
if (masterNotAdded) {
masterNotAdded = true;
addMasterDocument();
@@ -200,9 +202,6 @@ void ComponentView::searchForComponentAndAddToList(const ModelNode &node)
if (!hasEntryForNode(node)) {
QString description = descriptionForNode(node);
QStandardItem *item = new QStandardItem(description);
item->setData(QVariant::fromValue(node.internalId()), ModelNodeRole);
item->setEditable(false);