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

Method contextMenuEvent

plugins/classbrowser/classtree.cpp:57–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57void ClassTree::contextMenuEvent(QContextMenuEvent* e)
58{
59 auto* menu = new QMenu(this);
60 QModelIndex index = indexAt(e->pos());
61 if (index.isValid()) {
62 Context* c;
63 {
64 DUChainReadLocker readLock(DUChain::lock());
65 if (auto* decl = dynamic_cast<Declaration*>(model()->duObjectForIndex(index)))
66 c = new DeclarationContext(decl);
67 else
68 {
69 delete menu;
70 return;
71 }
72 }
73 _populatingClassBrowserContextMenu = true;
74
75 QList<ContextMenuExtension> extensions =
76 ICore::self()->pluginController()->queryPluginsForContextMenuExtensions(c, menu);
77 ContextMenuExtension::populateMenu(menu, extensions);
78
79 _populatingClassBrowserContextMenu = false;
80 }
81
82 if (!menu->actions().isEmpty())
83 menu->exec(e->globalPos());
84 delete menu;
85}
86
87bool ClassTree::event(QEvent* event)
88{

Callers

nothing calls this directly

Calls 9

modelFunction · 0.85
posMethod · 0.80
duObjectForIndexMethod · 0.80
pluginControllerMethod · 0.80
execMethod · 0.80
isValidMethod · 0.45
isEmptyMethod · 0.45
actionsMethod · 0.45

Tested by

no test coverage detected