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:
Thomas Hartmann
2014-03-05 15:57:40 +01:00
parent a8a9786b91
commit 53e687eca6

View File

@@ -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();