ClangTools: Avoid freezing UI for many items

...if new items are added to the model or if filter is used.

When items were added, we have called
ClangToolsDiagnosticModel::diagnostics() two times:
 * from DiagnosticFilterModel::filterAcceptsRow()
 * from ClangTidyClazyTool::handleStateUpdate()

However, this does not scale since diagnostics() creates a temporary.

Fix this by accessing the diagnostics or the count directly from the
tree.

Change-Id: I4c6a32e0076c1b4228ed1b1ff9222c9918f92c5c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-05-29 12:30:59 +02:00
parent 6b9ff15ad5
commit c6f12991b0
3 changed files with 12 additions and 4 deletions

View File

@@ -395,7 +395,7 @@ void ClangTidyClazyTool::handleStateUpdate()
QTC_ASSERT(m_diagnosticModel, return);
QTC_ASSERT(m_diagnosticFilterModel, return);
const int issuesFound = m_diagnosticModel->diagnostics().count();
const int issuesFound = m_diagnosticModel->diagnosticsCount();
const int issuesVisible = m_diagnosticFilterModel->rowCount();
m_goBack->setEnabled(issuesVisible > 1);
m_goNext->setEnabled(issuesVisible > 1);