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 <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2020-10-23 13:02:08 +02:00
parent d7ab6210af
commit 061a56143c
3 changed files with 6 additions and 13 deletions

View File

@@ -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.

View File

@@ -69,7 +69,7 @@
<item>
<widget class="QPushButton" name="topicsResetButton">
<property name="text">
<string>Reset to All</string>
<string>Reset Filter</string>
</property>
</widget>
</item>

View File

@@ -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);