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

Method contextMenu

plugins/network/networkreplywidget.cpp:128–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126NetworkReplyWidget::~NetworkReplyWidget() = default;
127
128void NetworkReplyWidget::contextMenu(QPoint pos)
129{
130 const auto index = ui->replyView->indexAt(pos);
131 if (!index.isValid())
132 return;
133
134 const auto objectId = index.sibling(index.row(), NetworkReplyModelColumn::ObjectColumn).data(NetworkReplyModelRole::ObjectIdRole).value<ObjectId>();
135 const auto url = index.sibling(index.row(), NetworkReplyModelColumn::UrlColumn).data(Qt::DisplayRole).toString();
136
137 QMenu menu;
138 if (!url.isEmpty()) {
139 auto action = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-copy")), tr("Copy URL"));
140 connect(action, &QAction::triggered, this, [url]() {
141 QGuiApplication::clipboard()->setText(url);
142 });
143 menu.addSeparator();
144 }
145
146 ContextMenuExtension ext(objectId);
147 ext.populateMenu(&menu);
148 menu.exec(ui->replyView->viewport()->mapToGlobal(pos));
149}

Callers

nothing calls this directly

Calls 6

rowMethod · 0.80
populateMenuMethod · 0.80
isValidMethod · 0.45
dataMethod · 0.45
isEmptyMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected