support displaying completions from editor context menu

This commit is contained in:
Axel Kohlmeyer
2023-09-02 10:48:36 -04:00
parent 98b803eba9
commit cf9ce0ebed
3 changed files with 7 additions and 1 deletions

View File

@ -502,9 +502,14 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
// print augmented context menu if an entry was found // print augmented context menu if an entry was found
auto *menu = createStandardContextMenu(); auto *menu = createStandardContextMenu();
menu->addSeparator();
auto action = menu->addAction(QString("Display available completions").arg(help));
action->setIcon(QIcon(":/expand-text.png"));
connect(action, &QAction::triggered, this, &CodeEditor::runCompletion);
if (!page.isEmpty()) { if (!page.isEmpty()) {
menu->addSeparator(); menu->addSeparator();
auto action = menu->addAction(QString("Reformat '%1' command").arg(help)); action = menu->addAction(QString("Reformat '%1' command").arg(help));
action->setIcon(QIcon(":/format-indent-less-3.png")); action->setIcon(QIcon(":/format-indent-less-3.png"));
connect(action, &QAction::triggered, this, &CodeEditor::reformatCurrentLine); connect(action, &QAction::triggered, this, &CodeEditor::reformatCurrentLine);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -23,6 +23,7 @@
<file>edit-redo.png</file> <file>edit-redo.png</file>
<file>edit-undo.png</file> <file>edit-undo.png</file>
<file>emblem-photos.png</file> <file>emblem-photos.png</file>
<file>expand-text.png</file>
<file>format-indent-less-3.png</file> <file>format-indent-less-3.png</file>
<file>go-first.png</file> <file>go-first.png</file>
<file>go-last.png</file> <file>go-last.png</file>