diff --git a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp index f07b74f8692..69c74ec6cf8 100644 --- a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp +++ b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "basetexteditmodifier.h" +#include "qmljseditor/qmljseditor.h" #include #include @@ -111,7 +112,10 @@ bool BaseTextEditModifier::moveToComponent(int nodeOffset) if (!object) return false; - QmlJSEditor::performComponentFromObjectDef(document->filePath().toString(), object); + QmlJSEditor::performComponentFromObjectDef(qobject_cast( + m_textEdit), + document->filePath().toString(), + object); return true; } } diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp index 98713d1a367..b29d1627db5 100644 --- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp +++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp @@ -246,13 +246,16 @@ void matchComponentFromObjectDefQuickFix(const QmlJSQuickFixAssistInterface *int } } -void performComponentFromObjectDef(const QString &fileName, QmlJS::AST::UiObjectDefinition *objDef) +void performComponentFromObjectDef(QmlJSEditorWidget *editor, + const QString &fileName, + QmlJS::AST::UiObjectDefinition *objDef) { QmlJSRefactoringChanges refactoring(QmlJS::ModelManagerInterface::instance(), QmlJS::ModelManagerInterface::instance()->snapshot()); QmlJSRefactoringFilePtr current = refactoring.file(Utils::FilePath::fromString(fileName)); - Operation operation(nullptr, objDef); + QmlJSQuickFixAssistInterface interface(editor, TextEditor::AssistReason::ExplicitlyInvoked); + Operation operation(&interface, objDef); operation.performChanges(current, refactoring); } diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.h b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.h index 8ac708aed2e..72a0f50e20e 100644 --- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.h +++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.h @@ -8,10 +8,13 @@ namespace QmlJSEditor { +class QmlJSEditorWidget; + QMLJSEDITOR_EXPORT void matchComponentFromObjectDefQuickFix( const Internal::QmlJSQuickFixAssistInterface *interface, QuickFixOperations &result); -QMLJSEDITOR_EXPORT void performComponentFromObjectDef - (const QString &fileName, QmlJS::AST::UiObjectDefinition *objDef); +QMLJSEDITOR_EXPORT void performComponentFromObjectDef(QmlJSEditorWidget *editor, + const QString &fileName, + QmlJS::AST::UiObjectDefinition *objDef); } // namespace QmlJSEditor