MCPcopy Create free account
hub / github.com/KDAB/GammaRay / contextMenu

Method contextMenu

plugins/timertop/timertopwidget.cpp:71–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69TimerTopWidget::~TimerTopWidget() = default;
70
71void TimerTopWidget::contextMenu(QPoint pos)
72{
73 auto index = ui->timerView->indexAt(pos);
74 if (!index.isValid())
75 return;
76 index = index.sibling(index.row(), 0);
77
78 const auto objectId = index.data(ObjectModel::ObjectIdRole).value<ObjectId>();
79 if (objectId.isNull())
80 return;
81
82 QMenu menu;
83 ContextMenuExtension ext(objectId);
84 ext.setLocation(ContextMenuExtension::Creation, index.data(ObjectModel::CreationLocationRole).value<SourceLocation>());
85 ext.setLocation(ContextMenuExtension::Declaration, index.data(ObjectModel::DeclarationLocationRole).value<SourceLocation>());
86 ext.populateMenu(&menu);
87 menu.exec(ui->timerView->viewport()->mapToGlobal(pos));
88}

Callers

nothing calls this directly

Calls 6

rowMethod · 0.80
setLocationMethod · 0.80
populateMenuMethod · 0.80
isValidMethod · 0.45
dataMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected