Add a ShowContextMenu action

Allow users without physical MenuKey to open the context menu

Change-Id: Id886a5614e26d614cba6ceb3b08a9df6148e9655
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Jesus Fernandez
2017-06-01 17:15:35 +02:00
committed by Jesus Fernandez
parent 9a0eca15c5
commit f3cd5cdb7e
4 changed files with 19 additions and 0 deletions

View File

@@ -119,6 +119,15 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
editor->editorWidget()->invokeAssist(QuickFix);
});
QAction *showContextMenuAction = new QAction(tr("Show Context Menu"), this);
ActionManager::registerAction(showContextMenuAction,
Constants::SHOWCONTEXTMENU,
context);
connect(showContextMenuAction, &QAction::triggered, []() {
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor())
editor->editorWidget()->showContextMenu();
});
// Generic highlighter.
connect(ICore::instance(), &ICore::coreOpened, Manager::instance(), &Manager::registerHighlightingFiles);