MCPcopy Create free account
hub / github.com/baldurk/renderdoc / contextMenuEvent

Method contextMenuEvent

qrenderdoc/Widgets/Extended/RDTreeView.cpp:329–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329void RDTreeView::contextMenuEvent(QContextMenuEvent *event)
330{
331 QPoint pos = event->pos();
332
333 QModelIndex index = indexAt(pos);
334
335 QMenu contextMenu(this);
336
337 QAction expandAllAction(tr("&Expand All"), this);
338 QAction collapseAllAction(tr("&Collapse All"), this);
339 QAction copy(tr("&Copy"), this);
340
341 if(rootIsDecorated())
342 {
343 contextMenu.addAction(&expandAllAction);
344 contextMenu.addAction(&collapseAllAction);
345 contextMenu.addSeparator();
346 }
347 contextMenu.addAction(&copy);
348
349 expandAllAction.setIcon(Icons::arrow_out());
350 collapseAllAction.setIcon(Icons::arrow_in());
351
352 copy.setIcon(Icons::copy());
353
354 expandAllAction.setEnabled(index.isValid() && model()->rowCount(index) > 0);
355 collapseAllAction.setEnabled(index.isValid() && model()->rowCount(index) > 0);
356
357 QObject::connect(&expandAllAction, &QAction::triggered, [this, index]() { expandAll(index); });
358
359 QObject::connect(&collapseAllAction, &QAction::triggered, [this, index]() { collapseAll(index); });
360
361 QObject::connect(&copy, &QAction::triggered, [this, index, pos]() { copyIndex(pos, index); });
362
363 emit customContextMenu(index, &contextMenu);
364
365 RDDialog::show(&contextMenu, viewport()->mapToGlobal(pos));
366}
367
368void RDTreeView::copyIndex(QPoint pos, QModelIndex index)
369{

Callers

nothing calls this directly

Calls 9

indexAtFunction · 0.85
connectFunction · 0.85
trFunction · 0.50
copyFunction · 0.50
modelFunction · 0.50
showFunction · 0.50
setIconMethod · 0.45
isValidMethod · 0.45
rowCountMethod · 0.45

Tested by

no test coverage detected