forked from qt-creator/qt-creator
QmlDesigner: Fixing regression for id renaming
When we rename an id we actually trigger a refactoring operation on the qml text. Due to recent changes we delay and compress qml changes from the text side using a 400ms timer. This is fatal for renaming ids. When we trigger refactoring operations on the text we have to ensure the update is done instantly without delay. To ensure this we use the memeber m_instantQmlTextUpdate. Change-Id: Ie007ee99f201cd444033c38630d7e7a9f5a673b5 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -189,6 +189,7 @@ private: //variables
|
||||
QString m_rewritingErrorMessage;
|
||||
QString m_lastCorrectQmlSource;
|
||||
QTimer m_amendTimer;
|
||||
bool m_instantQmlTextUpdate = false;
|
||||
};
|
||||
|
||||
} //QmlDesigner
|
||||
|
@@ -573,8 +573,13 @@ bool RewriterView::renameId(const QString& oldId, const QString& newId)
|
||||
&& rootModelNode().hasBindingProperty(propertyName)
|
||||
&& rootModelNode().bindingProperty(propertyName).isAliasExport();
|
||||
|
||||
bool instant = m_instantQmlTextUpdate;
|
||||
m_instantQmlTextUpdate = true;
|
||||
|
||||
bool refactoring = textModifier()->renameId(oldId, newId);
|
||||
|
||||
m_instantQmlTextUpdate = instant;
|
||||
|
||||
if (refactoring && hasAliasExport) { //Keep export alias properties
|
||||
rootModelNode().removeProperty(propertyName);
|
||||
PropertyName newPropertyName = newId.toUtf8();
|
||||
@@ -675,7 +680,12 @@ void RewriterView::moveToComponent(const ModelNode &modelNode)
|
||||
{
|
||||
int offset = nodeOffset(modelNode);
|
||||
|
||||
bool instant = m_instantQmlTextUpdate;
|
||||
m_instantQmlTextUpdate = true;
|
||||
|
||||
textModifier()->moveToComponent(offset);
|
||||
|
||||
m_instantQmlTextUpdate = instant;
|
||||
}
|
||||
|
||||
QStringList RewriterView::autoComplete(const QString &text, int pos, bool explicitComplete)
|
||||
@@ -736,7 +746,10 @@ void RewriterView::qmlTextChanged()
|
||||
}
|
||||
|
||||
case Amend: {
|
||||
m_amendTimer.start(400);
|
||||
if (m_instantQmlTextUpdate)
|
||||
amendQmlText();
|
||||
else
|
||||
m_amendTimer.start(400);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user