forked from qt-creator/qt-creator
QmlDesigner: reduce editor changed signals
- detaching the TextEditView already emits the TextEditor change signal -> so removing the call from QmlDesignerPlugin::deactivateAutoSynchronization() - in case the user closed explicit the editor we do not want to emit any signals anymore Change-Id: Idb5c2cdde583f7d32f2a9ef5628d1b6d3fc7bb3f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
b25d21f42e
commit
668c87ffd9
@@ -45,6 +45,7 @@
|
|||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
#include <qtsupport/qtversionmanager.h>
|
#include <qtsupport/qtversionmanager.h>
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
|
|
||||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||||
|
|
||||||
@@ -605,6 +606,13 @@ RewriterView *DesignDocument::rewriterView() const
|
|||||||
void DesignDocument::setEditor(Core::IEditor *editor)
|
void DesignDocument::setEditor(Core::IEditor *editor)
|
||||||
{
|
{
|
||||||
m_textEditor = editor;
|
m_textEditor = editor;
|
||||||
|
// if the user closed the file explicit we do not want to do anything with it anymore
|
||||||
|
connect(Core::EditorManager::instance(), &Core::EditorManager::editorAboutToClose,
|
||||||
|
this, [this](Core::IEditor *editor) {
|
||||||
|
if (m_textEditor.data() == editor)
|
||||||
|
m_textEditor.clear();
|
||||||
|
});
|
||||||
|
|
||||||
connect(editor->document(), &Core::IDocument::filePathChanged,
|
connect(editor->document(), &Core::IDocument::filePathChanged,
|
||||||
this, &DesignDocument::updateFileName);
|
this, &DesignDocument::updateFileName);
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,11 @@ void TextEditorView::modelAboutToBeDetached(Model *model)
|
|||||||
|
|
||||||
m_widget->setTextEditor(0);
|
m_widget->setTextEditor(0);
|
||||||
|
|
||||||
QmlDesignerPlugin::instance()->emitCurrentTextEditorChanged(QmlDesignerPlugin::instance()->currentDesignDocument()->textEditor());
|
// in case the user closed it explicit we do not want to do anything with the editor
|
||||||
|
if (TextEditor::BaseTextEditor *textEditor =
|
||||||
|
QmlDesignerPlugin::instance()->currentDesignDocument()->textEditor()) {
|
||||||
|
QmlDesignerPlugin::instance()->emitCurrentTextEditorChanged(textEditor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEditorView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
|
void TextEditorView::importsChanged(const QList<Import> &/*addedImports*/, const QList<Import> &/*removedImports*/)
|
||||||
|
|||||||
@@ -413,7 +413,6 @@ void QmlDesignerPlugin::deactivateAutoSynchronization()
|
|||||||
viewManager().detachViewsExceptRewriterAndComponetView();
|
viewManager().detachViewsExceptRewriterAndComponetView();
|
||||||
viewManager().detachComponentView();
|
viewManager().detachComponentView();
|
||||||
viewManager().detachRewriterView();
|
viewManager().detachRewriterView();
|
||||||
emitCurrentTextEditorChanged(documentManager().currentDesignDocument()->textEditor());
|
|
||||||
documentManager().currentDesignDocument()->resetToDocumentModel();
|
documentManager().currentDesignDocument()->resetToDocumentModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user