CppTools: Allow filtering issues with line edit

...matching diagnostic text/description. Child items are excluded.

Change-Id: Ie7c50af59e0836f60b2ca3bbe50b11eb19398c61
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-05-15 11:27:14 +02:00
parent 0031dbb667
commit 887a0538cd
3 changed files with 24 additions and 1 deletions

View File

@@ -346,8 +346,11 @@ void DiagnosticFilterModel::addSuppressedDiagnostic(
bool DiagnosticFilterModel::filterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent) const
{
// Avoid filtering child diagnostics / explaining steps.
if (sourceParent.isValid())
return true;
// Is the diagnostic suppressed?
const Diagnostic diag = static_cast<ClangToolsDiagnosticModel *>(sourceModel())
->diagnostics().at(sourceRow);
foreach (const SuppressedDiagnostic &d, m_suppressedDiagnostics) {
@@ -360,7 +363,12 @@ bool DiagnosticFilterModel::filterAcceptsRow(int sourceRow,
if (filePath == diag.location.filePath)
return false;
}
return true;
// Does the diagnostic match the filter?
if (diag.description.contains(filterRegExp()))
return true;
return false;
}
void DiagnosticFilterModel::handleSuppressedDiagnosticsChanged()