QmlPreview: Fix enabled state of editor action

Kind of amends 42c1b15874.

Change-Id: Ifd340d0f9bb206c48fd82cecf4e735cca0d70a7d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Christian Stenger
2024-03-12 15:39:49 +01:00
parent 0817f7ae5e
commit fe5f959925

View File

@@ -199,7 +199,7 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
previewFileAction->setVisible(fileNode && fileNode->fileType() == FileType::QML); previewFileAction->setVisible(fileNode && fileNode->fileType() == FileType::QML);
}); });
connect(Core::EditorManager::instance(), &Core::EditorManager::editorOpened, this, connect(Core::EditorManager::instance(), &Core::EditorManager::editorOpened, this,
[runPreviewAction] (Core::IEditor *editor) { [] (Core::IEditor *editor) {
if (!editor) if (!editor)
return; return;
if (!editor->document()) if (!editor->document())
@@ -225,8 +225,8 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
{":/utils/images/run_small.png", Utils::Theme::IconsRunToolBarColor}, {":/utils/images/run_small.png", Utils::Theme::IconsRunToolBarColor},
{":/utils/images/eyeoverlay.png", Utils::Theme::IconsDebugColor} {":/utils/images/eyeoverlay.png", Utils::Theme::IconsDebugColor}
}).icon(); }).icon();
Utils::ProxyAction *action = Utils::ProxyAction *action = Utils::ProxyAction::proxyActionWithIcon(
Utils::ProxyAction::proxyActionWithIcon(runPreviewAction, icon); Core::ActionManager::command("QmlPreview.RunPreview")->action(), icon);
toolBar->insertAction(nullptr, action); toolBar->insertAction(nullptr, action);
}); });