ClangTools: Organize diagnostics by file path

* Introduce the file path as a top level node.
* Remove the location column.
  * Encode the line/column information in the DisplayRole, as for the
    Clang Code Model tooltips.
  * Double click on a diagnostic opens the editor.

Change-Id: I4c263537cc04c3c4feb6ccd5c395d60d8bee0bc3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2019-01-25 10:17:56 +01:00
parent d386b3c241
commit 26a6cf3bb3
7 changed files with 246 additions and 86 deletions

View File

@@ -216,7 +216,8 @@ ClangTidyClazyTool::ClangTidyClazyTool()
initDiagnosticView();
m_diagnosticView->setModel(m_diagnosticFilterModel);
m_diagnosticView->setSortingEnabled(true);
m_diagnosticView->sortByColumn(Debugger::DetailedErrorView::LocationColumn, Qt::AscendingOrder);
m_diagnosticView->sortByColumn(Debugger::DetailedErrorView::DiagnosticColumn,
Qt::AscendingOrder);
m_diagnosticView->setObjectName(QLatin1String("ClangTidyClazyIssuesView"));
m_diagnosticView->setWindowTitle(tr("Clang-Tidy and Clazy Issues"));
@@ -299,7 +300,7 @@ ClangTidyClazyTool::ClangTidyClazyTool()
});
connect(m_applyFixitsButton, &QToolButton::clicked, [this]() {
QVector<DiagnosticItem *> diagnosticItems;
m_diagnosticModel->rootItem()->forChildrenAtLevel(1, [&](TreeItem *item){
m_diagnosticModel->rootItem()->forChildrenAtLevel(2, [&](TreeItem *item){
diagnosticItems += static_cast<DiagnosticItem *>(item);
});