QmlDesigner: Only the rewriter for the document should block UI

We use different rewriter for different purposes. Only
the rewriter that manages the current document should disable the UI.

Change-Id: Ic410f7ee62ce13bb0eef133619f93c05b5632a56
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2018-05-02 15:23:36 +02:00
committed by Tim Jenssen
parent cf43803032
commit 0087a74ecc
3 changed files with 13 additions and 2 deletions

View File

@@ -42,6 +42,7 @@ class DesignDocument;
class AbstractCustomTool; class AbstractCustomTool;
class DesignerActionManager; class DesignerActionManager;
class NodeInstanceView; class NodeInstanceView;
class RewriterView;
namespace Internal { class DesignModeWidget; } namespace Internal { class DesignModeWidget; }
@@ -98,6 +99,8 @@ public:
void qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const; void qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const;
DesignDocument *currentDesignDocument() const; DesignDocument *currentDesignDocument() const;
bool usesRewriterView(RewriterView *rewriterView);
private: // functions private: // functions
Q_DISABLE_COPY(ViewManager) Q_DISABLE_COPY(ViewManager)

View File

@@ -873,8 +873,11 @@ void RewriterView::qmlTextChanged()
amendQmlText(); amendQmlText();
} else { } else {
#ifndef QMLDESIGNER_TEST #ifndef QMLDESIGNER_TEST
QmlDesignerPlugin::instance()->viewManager().disableWidgets(); auto &viewManager = QmlDesignerPlugin::instance()->viewManager();
m_amendTimer.start(400); if (viewManager.usesRewriterView(this)) {
QmlDesignerPlugin::instance()->viewManager().disableWidgets();
m_amendTimer.start(400);
}
#else #else
/*Keep test synchronous*/ /*Keep test synchronous*/
amendQmlText(); amendQmlText();

View File

@@ -449,6 +449,11 @@ void ViewManager::reformatFileUsingTextEditorView()
d->textEditorView.reformatFile(); d->textEditorView.reformatFile();
} }
bool ViewManager::usesRewriterView(RewriterView *rewriterView)
{
return currentDesignDocument()->rewriterView() == rewriterView;
}
} // namespace QmlDesigner } // namespace QmlDesigner
#endif //QMLDESIGNER_TEST #endif //QMLDESIGNER_TEST