Squish: Fix adding object by copy and paste

Pasting an object should directly add the object at the
right branch of the tree if necessary.
So, in case of having a container or widget property
the new item has to be added as a child of this.

Change-Id: I0d7398eec8ae7b5bf6414a525e695d52b13b1113
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2022-11-11 13:40:17 +01:00
parent b55c10f189
commit 47353584f9

View File

@@ -284,7 +284,14 @@ void ObjectsMapModel::addNewObject(ObjectsMapTreeItem *item)
QTC_ASSERT(item, return );
QTC_ASSERT(rootItem(), return );
rootItem()->appendChild(item);
auto parentItem = rootItem();
const QString parentName = item->parentName();
if (!parentName.isEmpty()) {
if (auto found = findItem(parentName))
parentItem = found;
}
parentItem->appendChild(item);
emit modelChanged();
}