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

Method contextMenu

plugins/qmlsupport/qmltypetab.cpp:45–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43QmlTypeTab::~QmlTypeTab() = default;
44
45void QmlTypeTab::contextMenu(QPoint pos)
46{
47 // TODO share this with PropertiesTab
48 const auto idx = ui->typeView->indexAt(pos);
49 if (!idx.isValid())
50 return;
51
52 const auto actions = idx.data(PropertyModel::ActionRole).toInt();
53 const auto objectId = idx.data(PropertyModel::ObjectIdRole).value<ObjectId>();
54 ContextMenuExtension ext(objectId);
55 const bool canShow = actions != PropertyModel::NoAction
56 || ext.discoverPropertySourceLocation(ContextMenuExtension::GoTo, idx);
57
58 if (!canShow)
59 return;
60
61 QMenu contextMenu;
62 ext.populateMenu(&contextMenu);
63 contextMenu.exec(ui->typeView->viewport()->mapToGlobal(pos));
64}

Callers

nothing calls this directly

Calls 4

populateMenuMethod · 0.80
isValidMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected