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

Method handleMenuRequested

src/plugins/find/gui/searchresultwidget.cpp:89–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void SearchResultWidgetPrivate::handleMenuRequested(const QPoint &pos)
90{
91 QModelIndex index = resultView->indexAt(pos);
92 if (!index.isValid())
93 return;
94
95 QMenu menu;
96 if (resultModel.hasChildren(index)) {
97 menu.addAction(SearchResultWidget::tr("Replace All"), this, std::bind(&SearchResultWidgetPrivate::readyReplace, this, index));
98 menu.addAction(SearchResultWidget::tr("Dismiss"), &resultModel, std::bind(&SearchResultModel::remove, &resultModel, index));
99 menu.addSeparator();
100 menu.addAction(SearchResultWidget::tr("Copy Path"), this,
101 [index] {
102 const auto &path = index.data(FilePathRole).toString();
103 QGuiApplication::clipboard()->setText(path);
104 });
105 } else {
106 menu.addAction(SearchResultWidget::tr("Replace"), this, std::bind(&SearchResultWidgetPrivate::readyReplace, this, index));
107 menu.addAction(SearchResultWidget::tr("Dismiss"), &resultModel, std::bind(&SearchResultModel::remove, &resultModel, index));
108 }
109
110 menu.exec(QCursor::pos());
111}
112
113void SearchResultWidgetPrivate::updateMessage()
114{

Callers

nothing calls this directly

Calls 8

addSeparatorMethod · 0.80
isValidMethod · 0.45
hasChildrenMethod · 0.45
addActionMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
setTextMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected