MCPcopy Create free account
hub / github.com/KDE/kdevelop / populateContextMenu

Method populateContextMenu

kdevplatform/shell/textdocument.cpp:718–741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

716}
717
718void KDevelop::TextDocument::populateContextMenu( KTextEditor::View* v, QMenu* menu )
719{
720 Q_D(TextDocument);
721
722 if (d->addedContextMenu) {
723 qCWarning(SHELL) << "populateContextMenu() called while we still handled another menu.";
724 d->cleanContextMenu();
725 }
726
727 d->currentContextMenu = menu;
728 connect(menu, &QMenu::aboutToHide, this, &TextDocument::unpopulateContextMenu);
729
730 d->addedContextMenu = new QMenu();
731
732 EditorContext c(v, v->cursorPosition());
733 auto extensions = Core::self()->pluginController()->queryPluginsForContextMenuExtensions(&c, d->addedContextMenu);
734
735 ContextMenuExtension::populateMenu(d->addedContextMenu, extensions);
736
737 const auto actions = d->addedContextMenu->actions();
738 for (QAction* action : actions) {
739 menu->addAction(action);
740 }
741}
742
743void KDevelop::TextDocument::repositoryCheckFinished(bool canRecreate) {
744 Q_D(TextDocument);

Callers

nothing calls this directly

Calls 6

cleanContextMenuMethod · 0.80
pluginControllerMethod · 0.80
cursorPositionMethod · 0.45
actionsMethod · 0.45
addActionMethod · 0.45

Tested by

no test coverage detected