| 880 | } |
| 881 | |
| 882 | void 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 | |
| 906 | void ResultsTree::hideResult() |
| 907 | { |
no test coverage detected