forked from qt-creator/qt-creator
QmlDesigner.CopyAndPaste: fix pasting into item without children
Pasting "into" an item that did not have any children did not work. The method hasNodeListProperty() only return true if the item already has children. Change-Id: I00d20df1673758b22d056b8dd64a52c760aabf18 Reviewed-by: Marco Bubke <marco.bubke@digia.com>
This commit is contained in:
@@ -552,8 +552,11 @@ void DesignDocument::paste()
|
||||
PropertyName defaultProperty(targetNode.metaInfo().defaultPropertyName());
|
||||
|
||||
scatterItem(pastedNode, targetNode);
|
||||
if (targetNode.hasNodeListProperty(defaultProperty))
|
||||
if (targetNode.metaInfo().propertyIsListProperty(defaultProperty)) {
|
||||
targetNode.nodeListProperty(defaultProperty).reparentHere(pastedNode);
|
||||
} else {
|
||||
qWarning() << "Cannot reparent to" << targetNode;
|
||||
}
|
||||
|
||||
transaction.commit();
|
||||
NodeMetaInfo::clearCache();
|
||||
|
Reference in New Issue
Block a user