From 061a56143c5f71b63e40cc54e109417d2dd6446f Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 23 Oct 2020 13:02:08 +0200 Subject: [PATCH] ClangTools: show all checks in clazy settings Show all checks if no filter is selected, otherwise checks with no categories will never be visible (qt-keywords). Change-Id: I2809afc050c7da6386a3e01d90c8ea6bcb7cab68 Reviewed-by: Leena Miettinen Reviewed-by: Christian Stenger --- .../analyze/creator-clang-static-analyzer.qdoc | 2 +- src/plugins/clangtools/clazychecks.ui | 2 +- .../clangtools/diagnosticconfigswidget.cpp | 15 ++++----------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/doc/qtcreator/src/analyze/creator-clang-static-analyzer.qdoc b/doc/qtcreator/src/analyze/creator-clang-static-analyzer.qdoc index 4f1ce5a8bd9..8fe248fa21b 100644 --- a/doc/qtcreator/src/analyze/creator-clang-static-analyzer.qdoc +++ b/doc/qtcreator/src/analyze/creator-clang-static-analyzer.qdoc @@ -188,7 +188,7 @@ \li In the \uicontrol {Topic Filter} field, select a topic to view only checks related to that area in the \uicontrol Checks field. - \li To view all checks again, select \uicontrol {Reset to All}. + \li To view all checks again, select \uicontrol {Reset Filter}. \li To view more information about the checks online, select the \uicontrol {Web Page} links next to them. diff --git a/src/plugins/clangtools/clazychecks.ui b/src/plugins/clangtools/clazychecks.ui index 0818b8d31e8..5704a6c2429 100644 --- a/src/plugins/clangtools/clazychecks.ui +++ b/src/plugins/clangtools/clazychecks.ui @@ -69,7 +69,7 @@ - Reset to All + Reset Filter diff --git a/src/plugins/clangtools/diagnosticconfigswidget.cpp b/src/plugins/clangtools/diagnosticconfigswidget.cpp index 9d076f8e29e..9375e84c21f 100644 --- a/src/plugins/clangtools/diagnosticconfigswidget.cpp +++ b/src/plugins/clangtools/diagnosticconfigswidget.cpp @@ -199,13 +199,6 @@ static bool needsLink(ProjectExplorer::Tree *node) { return !node->isDir && !node->fullPath.toString().startsWith("clang-analyzer-"); } -static void selectAll(QAbstractItemView *view) -{ - view->setSelectionMode(QAbstractItemView::MultiSelection); - view->selectAll(); - view->setSelectionMode(QAbstractItemView::SingleSelection); -} - class BaseChecksTreeModel : public ProjectExplorer::SelectableFilesModel { Q_OBJECT @@ -628,7 +621,7 @@ public: const auto *node = ClazyChecksTree::fromIndex(index); if (node->kind == ClazyChecksTree::CheckNode) { const QStringList topics = node->check.topics; - return Utils::anyOf(m_topics, [topics](const QString &topic) { + return m_topics.isEmpty() || Utils::anyOf(m_topics, [topics](const QString &topic) { return topics.contains(topic); }); } @@ -717,8 +710,9 @@ DiagnosticConfigsWidget::DiagnosticConfigsWidget(const ClangDiagnosticConfigs &c topicsModel->sort(0); m_clazyChecks->topicsView->setModel(topicsModel); connect(m_clazyChecks->topicsResetButton, &QPushButton::clicked, [this](){ - selectAll(m_clazyChecks->topicsView); + m_clazyChecks->topicsView->clearSelection(); }); + m_clazyChecks->topicsView->setSelectionMode(QAbstractItemView::MultiSelection); connect(m_clazyChecks->topicsView->selectionModel(), &QItemSelectionModel::selectionChanged, [this, topicsModel](const QItemSelection &, const QItemSelection &) { @@ -731,7 +725,6 @@ DiagnosticConfigsWidget::DiagnosticConfigsWidget(const ClangDiagnosticConfigs &c this->syncClazyChecksGroupBox(); }); - selectAll(m_clazyChecks->topicsView); connect(m_clazyChecks->checksView, &QTreeView::clicked, [model = m_clazySortFilterProxyModel](const QModelIndex &index) { @@ -866,7 +859,7 @@ void DiagnosticConfigsWidget::syncClazyWidgets(const ClangDiagnosticConfig &conf const bool enabled = !config.isReadOnly(); m_clazyChecks->topicsResetButton->setEnabled(enabled); m_clazyChecks->enableLowerLevelsCheckBox->setEnabled(enabled); - selectAll(m_clazyChecks->topicsView); + m_clazyChecks->topicsView->clearSelection(); m_clazyChecks->topicsView->setEnabled(enabled); m_clazyTreeModel->setEnabled(enabled);