Commit 1e7c7547 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.rewriter: crash fix

When converting nodes into implcit components the default properties
turns from a list property into a (single) node property.
This patch takes this into account.

Change-Id: I85f7ee1f8109da0c001804a0804a07b7acdee3ca
Reviewed-on: http://codereview.qt.nokia.com/135Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent 8a04f4a6
......@@ -1450,7 +1450,7 @@ ModelNode ModelAmender::listPropertyMissingModelNode(NodeListProperty &modelProp
if (propertyTakesComponent)
m_merger->setupComponent(newNode);
if (modelProperty.isDefaultProperty()) { //In the default property case we do some magic
if (modelProperty.isDefaultProperty() || isComponentType(modelProperty.parentModelNode().type())) { //In the default property case we do some magic
if (modelProperty.isNodeListProperty()) {
modelProperty.reparentHere(newNode);
} else { //The default property could a NodeProperty implicitly (delegate:)
......@@ -1490,7 +1490,7 @@ void ModelAmender::typeDiffers(bool isRootNode,
context,
*this);
parentProperty.reparentHere(newNode);
if (nodeIndex >= 0) {
if (parentProperty.isNodeListProperty()) {
int currentIndex = parentProperty.toNodeListProperty().toModelNodeList().indexOf(newNode);
if (nodeIndex != currentIndex)
parentProperty.toNodeListProperty().slide(currentIndex, nodeIndex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment