forked from qt-creator/qt-creator
ClangTools: Enable filtering in config widget
This makes it easy to search for certain checks. Fixes: QTCREATORBUG-24851 Change-Id: I94521aade4b54e80113aa31db9bed91ecb230016 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
@@ -63,13 +63,23 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Topic Filter</string>
|
||||
<string>Filters</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="Utils::FancyLineEdit" name="filterLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="topicsResetButton">
|
||||
<property name="text">
|
||||
<string>Reset Filter</string>
|
||||
<string>Reset Topic Filter</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -162,6 +172,11 @@ Set a valid executable first.</string>
|
||||
<extends>QLabel</extends>
|
||||
<header location="global">utils/infolabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Utils::FancyLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">utils/fancylineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@@ -734,6 +734,9 @@ public:
|
||||
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
|
||||
{
|
||||
if (!QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent))
|
||||
return false;
|
||||
|
||||
const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
if (!index.isValid())
|
||||
return false;
|
||||
@@ -823,7 +826,16 @@ DiagnosticConfigsWidget::DiagnosticConfigsWidget(const ClangDiagnosticConfigs &c
|
||||
m_clazyChecks->invalidExecutableLabel->setElideMode(Qt::ElideNone);
|
||||
m_clazySortFilterProxyModel = new ClazyChecksSortFilterModel(this);
|
||||
m_clazySortFilterProxyModel->setSourceModel(m_clazyTreeModel.get());
|
||||
m_clazySortFilterProxyModel->setRecursiveFilteringEnabled(true);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
m_clazySortFilterProxyModel->setAutoAcceptChildRows(true);
|
||||
#endif
|
||||
setupTreeView(m_clazyChecks->checksView, m_clazySortFilterProxyModel, 2);
|
||||
m_clazyChecks->filterLineEdit->setFiltering(true);
|
||||
m_clazyChecks->filterLineEdit->setPlaceholderText(tr("Textual Filter"));
|
||||
connect(m_clazyChecks->filterLineEdit, &Utils::FancyLineEdit::filterChanged,
|
||||
m_clazySortFilterProxyModel,
|
||||
qOverload<const QString &>(&QSortFilterProxyModel::setFilterRegularExpression));
|
||||
m_clazyChecks->checksView->setSortingEnabled(true);
|
||||
m_clazyChecks->checksView->sortByColumn(0, Qt::AscendingOrder);
|
||||
auto topicsModel = new QStringListModel(Utils::toList(m_clazyTreeModel->topics()), this);
|
||||
@@ -865,11 +877,21 @@ DiagnosticConfigsWidget::DiagnosticConfigsWidget(const ClangDiagnosticConfigs &c
|
||||
m_tidyChecks->setupUi(m_tidyChecksWidget);
|
||||
m_tidyChecks->invalidExecutableLabel->setType(Utils::InfoLabel::Warning);
|
||||
m_tidyChecks->invalidExecutableLabel->setElideMode(Qt::ElideNone);
|
||||
setupTreeView(m_tidyChecks->checksPrefixesTree, m_tidyTreeModel.get());
|
||||
const auto tidyFilterModel = new QSortFilterProxyModel(this);
|
||||
tidyFilterModel->setRecursiveFilteringEnabled(true);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
tidyFilterModel->setAutoAcceptChildRows(true);
|
||||
#endif
|
||||
tidyFilterModel->setSourceModel(m_tidyTreeModel.get());
|
||||
setupTreeView(m_tidyChecks->checksPrefixesTree, tidyFilterModel);
|
||||
m_tidyChecks->filterLineEdit->setFiltering(true);
|
||||
connect(m_tidyChecks->filterLineEdit, &Utils::FancyLineEdit::filterChanged, tidyFilterModel,
|
||||
qOverload<const QString &>(&QSortFilterProxyModel::setFilterRegularExpression));
|
||||
|
||||
connect(m_tidyChecks->checksPrefixesTree,
|
||||
&QTreeView::clicked,
|
||||
[this](const QModelIndex &index) {
|
||||
[this, tidyFilterModel](const QModelIndex &proxyIndex) {
|
||||
const QModelIndex index = tidyFilterModel->mapToSource(proxyIndex);
|
||||
if (index.column() == 2) {
|
||||
if (m_tidyTreeModel->hasChildren(index))
|
||||
return;
|
||||
|
@@ -49,6 +49,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Utils::FancyLineEdit" name="filterLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -164,6 +167,11 @@ Set a valid executable first.</string>
|
||||
<extends>QLabel</extends>
|
||||
<header location="global">utils/infolabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Utils::FancyLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header location="global">utils/fancylineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
Reference in New Issue
Block a user