MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / contextMenuEvent

Method contextMenuEvent

src/plugins/smartut/gui/projecttreeview.cpp:163–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163void ProjectTreeView::contextMenuEvent(QContextMenuEvent *event)
164{
165 QModelIndex index = indexAt(event->pos());
166 auto item = d->model->itemForIndex(index);
167 if (!item)
168 return;
169
170 QMenu menu;
171 if (d->viewType == UnitTest)
172 d->createUTActoins(&menu, item);
173
174 if (!item->itemNode->isFileNodeType()) {
175 menu.addSeparator();
176 if (isExpanded(index))
177 menu.addAction(tr("Collapse"), this, std::bind(&ProjectTreeView::collapse, this, index));
178 else
179 menu.addAction(tr("Expand"), this, std::bind(&ProjectTreeView::expand, this, index));
180 menu.addAction(tr("Collapse All"), this, &ProjectTreeView::collapseAll);
181 menu.addAction(tr("Expand All"), this, &ProjectTreeView::expandAll);
182 }
183
184 if (!menu.actions().isEmpty())
185 menu.exec(QCursor::pos());
186}

Callers

nothing calls this directly

Calls 8

createUTActoinsMethod · 0.80
addSeparatorMethod · 0.80
itemForIndexMethod · 0.45
isFileNodeTypeMethod · 0.45
addActionMethod · 0.45
isEmptyMethod · 0.45
actionsMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected