MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / copy

Method copy

gui/resultstree.cpp:882–904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

880}
881
882void ResultsTree::copy()
883{
884 if (!mSelectionModel)
885 return;
886
887 QString text;
888 for (const QModelIndex& index : mSelectionModel->selectedRows()) {
889 const auto *item = dynamic_cast<ResultItem*>(mModel->itemFromIndex(index));
890 if (!item)
891 continue;
892 if (item->getType() == ResultItem::Type::file)
893 text += item->text() + '\n';
894 else if (item->getType() == ResultItem::Type::message)
895 text += item->errorItem->toString() + '\n';
896 else if (item->getType() == ResultItem::Type::note) {
897 const auto e = item->getErrorPathItem();
898 text += e.file + ":" + QString::number(e.line) + ":" + QString::number(e.column) + ":note: " + e.info + '\n';
899 }
900 }
901
902 QClipboard *clipboard = QApplication::clipboard();
903 clipboard->setText(text);
904}
905
906void ResultsTree::hideResult()
907{

Callers 4

SettingsDialogMethod · 0.45
okMethod · 0.45
setup.pyFile · 0.45
isKeywordFunction · 0.45

Calls 3

getErrorPathItemMethod · 0.80
getTypeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected