only offer completion in context menu, if there is something to complete
This commit is contained in:
@ -686,13 +686,15 @@ 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();
|
menu->addSeparator();
|
||||||
|
if (!help.isEmpty()) {
|
||||||
auto action = menu->addAction(QString("Display available completions for '%1'").arg(help));
|
auto action = menu->addAction(QString("Display available completions for '%1'").arg(help));
|
||||||
action->setIcon(QIcon(":/icons/expand-text.png"));
|
action->setIcon(QIcon(":/icons/expand-text.png"));
|
||||||
connect(action, &QAction::triggered, this, &CodeEditor::runCompletion);
|
connect(action, &QAction::triggered, this, &CodeEditor::runCompletion);
|
||||||
|
}
|
||||||
|
|
||||||
if (!page.isEmpty()) {
|
if (!page.isEmpty()) {
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
action = menu->addAction(QString("Reformat '%1' command").arg(help));
|
auto action = menu->addAction(QString("Reformat '%1' command").arg(help));
|
||||||
action->setIcon(QIcon(":/icons/format-indent-less-3.png"));
|
action->setIcon(QIcon(":/icons/format-indent-less-3.png"));
|
||||||
connect(action, &QAction::triggered, this, &CodeEditor::reformatCurrentLine);
|
connect(action, &QAction::triggered, this, &CodeEditor::reformatCurrentLine);
|
||||||
|
|
||||||
@ -714,10 +716,10 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
connect(action2, &QAction::triggered, this, &CodeEditor::open_help);
|
connect(action2, &QAction::triggered, this, &CodeEditor::open_help);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto action3 = menu->addAction(QString("LAMMPS Manual"));
|
auto action = menu->addAction(QString("LAMMPS Manual"));
|
||||||
action3->setIcon(QIcon(":/icons/help-browser.png"));
|
action->setIcon(QIcon(":/icons/help-browser.png"));
|
||||||
action3->setData(QString());
|
action->setData(QString());
|
||||||
connect(action3, &QAction::triggered, this, &CodeEditor::open_help);
|
connect(action, &QAction::triggered, this, &CodeEditor::open_help);
|
||||||
|
|
||||||
menu->exec(event->globalPos());
|
menu->exec(event->globalPos());
|
||||||
delete menu;
|
delete menu;
|
||||||
|
|||||||
Reference in New Issue
Block a user