forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user