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

Method contextMenuEvent

kdevplatform/debugger/variable/variablewidget.cpp:276–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276void VariableTree::contextMenuEvent(QContextMenuEvent* event)
277{
278 auto* const selectedVariable = this->selectedVariable();
279 if (!selectedVariable)
280 return;
281
282 // set up menu
283 QMenu contextMenu(this->parentWidget());
284
285 m_contextMenuTitle->setText(selectedVariable == variableCollection()->watches()->returnValueVariable()
286 ? i18nc("%1 - the name of a GDB variable, e.g. \"$1\"",
287 "%1 (last function return value)", selectedVariable->expression())
288 : selectedVariable->expression());
289 contextMenu.addAction(m_contextMenuTitle);
290
291 if (selectedVariable->canSetFormat()) {
292 contextMenu.addMenu(m_formatMenu);
293 }
294
295 const auto formatMenuActions = m_formatMenu->actions();
296 for (QAction* act : formatMenuActions) {
297 if (act->data().toInt() == selectedVariable->format()) {
298 act->setChecked(true);
299 }
300 }
301
302 if (qobject_cast<Watches*>(selectedVariable->parent())) {
303 contextMenu.addAction(m_watchDelete);
304 }
305
306 contextMenu.addSeparator();
307 contextMenu.addAction(m_copyVariableValue);
308 if (canStopOnChange(*selectedVariable)) {
309 contextMenu.addAction(m_stopOnChange);
310 }
311
312 contextMenu.exec(event->globalPos());
313}
314
315QModelIndex VariableTree::mapViewIndexToTreeModelIndex(const QModelIndex& viewIndex) const
316{

Callers

nothing calls this directly

Calls 14

selectedVariableMethod · 0.95
variableCollectionFunction · 0.85
canStopOnChangeFunction · 0.85
returnValueVariableMethod · 0.80
canSetFormatMethod · 0.80
toIntMethod · 0.80
formatMethod · 0.80
execMethod · 0.80
setTextMethod · 0.45
expressionMethod · 0.45
addActionMethod · 0.45
actionsMethod · 0.45

Tested by

no test coverage detected