QmlDesigner: Select the correct text editor for paste action

The text editor was declared changed even in non-design mode. Now it's
notified only when the design mode is selected.

Task-number: QDS-9953
Change-Id: I64d0d7c1eec0e56d00f91e9522325ecb8660cd2d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Ali Kianian
2023-07-17 17:59:43 +03:00
parent a34b991448
commit 6f78cd1a3c

View File

@@ -16,12 +16,13 @@
#include <nodelistproperty.h>
#include <qmldesignerplugin.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/modemanager.h>
#include <texteditor/texteditor.h>
#include <texteditor/texteditorconstants.h>
@@ -97,9 +98,12 @@ void TextEditorView::modelAboutToBeDetached(Model *model)
m_widget->setTextEditor(nullptr);
// 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);
if (Core::ModeManager::currentModeId() == Core::Constants::MODE_DESIGN) {
if (TextEditor::BaseTextEditor *textEditor = QmlDesignerPlugin::instance()
->currentDesignDocument()
->textEditor()) {
QmlDesignerPlugin::instance()->emitCurrentTextEditorChanged(textEditor);
}
}
}