Commit 41cec55d authored by Thomas Hartmann's avatar Thomas Hartmann Committed by Thomas Hartmann

QmlDesigner: Keep export property alias if changing id

If the id of a ModelNode is changed the expression of an exporting property
(property alias id: id) is changed but not the property name.
So we get property alias oldId: newId.

To keep the exports consistent this code adjusts the property name
to the new id.

Change-Id: Ibd9c9f4a2e755fbfb7beeed458ea45270db7f666
Reviewed-by: default avatarTim Jenssen <>
parent f6d6db5b
......@@ -666,8 +666,22 @@ ModelNode RewriterView::nodeAtTextCursorPosition(int cursorPosition) const
bool RewriterView::renameId(const QString& oldId, const QString& newId)
if (textModifier())
return textModifier()->renameId(oldId, newId);
if (textModifier()) {
PropertyName propertyName = oldId.toLatin1();
bool hasAliasExport = rootModelNode().isValid()
&& rootModelNode().hasBindingProperty(propertyName)
&& rootModelNode().bindingProperty(propertyName).isAliasExport();
bool refactoring = textModifier()->renameId(oldId, newId);
if (refactoring && hasAliasExport) { //Keep export alias properties
PropertyName newPropertyName = newId.toLatin1();
rootModelNode().bindingProperty(newPropertyName).setDynamicTypeNameAndExpression("alias", newPropertyName);
return refactoring;
return false;
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