From 45bd886e3e52200512f362f2ca59d79972a2aa31 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 23 Sep 2022 12:35:38 +0200 Subject: [PATCH] TextEditor: add find usage to context menu ... of the generic text editor if the editor has the FindUsage optional action mask set. This is mainly used to show this action when a language server is configured for this editor that supports find usages. Change-Id: I55c6983cd553c46817332144f78f1207185ac3f6 Reviewed-by: Christian Stenger --- src/plugins/texteditor/texteditor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 4079b73c6b2..ce5441a8c9b 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -7935,10 +7935,13 @@ void TextEditorWidget::setupFallBackEditor(Id id) void TextEditorWidget::appendStandardContextMenuActions(QMenu *menu) { + if (optionalActions() & TextEditorActionHandler::FindUsage) + menu->addAction(ActionManager::command(Constants::FIND_USAGES)->action()); + menu->addSeparator(); appendMenuActionsFromContext(menu, Constants::M_STANDARDCONTEXTMENU); - Command *bomCmd = ActionManager::command(Constants::SWITCH_UTF8BOM); - if (bomCmd) { + + if (Command *bomCmd = ActionManager::command(Constants::SWITCH_UTF8BOM)) { QAction *a = bomCmd->action(); TextDocument *doc = textDocument(); if (doc->codec()->name() == QByteArray("UTF-8") && doc->supportsUtf8Bom()) {