From 6f78cd1a3cf8ec094e2eaf4b589646a6b127dfc8 Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Mon, 17 Jul 2023 17:59:43 +0300 Subject: [PATCH] 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: Reviewed-by: Tim Jenssen --- .../components/texteditor/texteditorview.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorview.cpp b/src/plugins/qmldesigner/components/texteditor/texteditorview.cpp index 6c6102036ac..0826df54848 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorview.cpp +++ b/src/plugins/qmldesigner/components/texteditor/texteditorview.cpp @@ -16,12 +16,13 @@ #include #include -#include #include +#include #include #include #include #include +#include #include #include @@ -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); + } } }