forked from qt-creator/qt-creator
QmlDesigner: Improve speed of undo
Undo works strickly on the text editor and we wait 600ms until we propagte changes from text editor to the model, to not interrupt typing. In this case we should force the update immediately. Change-Id: I5c854e7b4c6936e02c57d4cc7433a6e0ede50af4 Reviewed-by: Burak Hancerli <burak.hancerli@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -700,16 +700,20 @@ ModelNode DesignDocument::rootModelNode() const
|
||||
|
||||
void DesignDocument::undo()
|
||||
{
|
||||
if (rewriterView() && !rewriterView()->modificationGroupActive())
|
||||
if (rewriterView() && !rewriterView()->modificationGroupActive()) {
|
||||
plainTextEdit()->undo();
|
||||
rewriterView()->forceAmend();
|
||||
}
|
||||
|
||||
viewManager().resetPropertyEditorView();
|
||||
}
|
||||
|
||||
void DesignDocument::redo()
|
||||
{
|
||||
if (rewriterView() && !rewriterView()->modificationGroupActive())
|
||||
if (rewriterView() && !rewriterView()->modificationGroupActive()) {
|
||||
plainTextEdit()->redo();
|
||||
rewriterView()->forceAmend();
|
||||
}
|
||||
|
||||
viewManager().resetPropertyEditorView();
|
||||
}
|
||||
|
@@ -170,6 +170,8 @@ public:
|
||||
bool possibleImportsEnabled() const;
|
||||
void setPossibleImportsEnabled(bool b);
|
||||
|
||||
void forceAmend();
|
||||
|
||||
signals:
|
||||
void modelInterfaceProjectUpdated();
|
||||
|
||||
|
@@ -703,6 +703,12 @@ void RewriterView::setPossibleImportsEnabled(bool b)
|
||||
m_possibleImportsEnabled = b;
|
||||
}
|
||||
|
||||
void RewriterView::forceAmend()
|
||||
{
|
||||
m_amendTimer.stop();
|
||||
amendQmlText();
|
||||
}
|
||||
|
||||
Internal::ModelNodePositionStorage *RewriterView::positionStorage() const
|
||||
{
|
||||
return m_positionStorage.data();
|
||||
|
Reference in New Issue
Block a user