ClangTools: Fix fail count displayed in info widget

Fixes: QTCREATORBUG-27330
Change-Id: I853d604c74d37179d56a16b71e1369cdc695c800
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-10-20 14:57:41 +02:00
parent 243f66f97d
commit 79dd4a59ec

View File

@@ -1142,11 +1142,13 @@ void ClangTool::updateForCurrentState()
m_diagnosticView->setCursor(isRunning ? Qt::BusyCursor : Qt::ArrowCursor);
// Info bar: errors
const bool hasErrorText = !m_infoBarWidget->errorText().isEmpty();
const bool hasErrors = m_filesFailed > 0;
if (hasErrors && !hasErrorText) {
const QString text = makeLink(tr("Failed to analyze %n file(s).", nullptr, m_filesFailed));
m_infoBarWidget->setError(InfoBarWidget::Warning, text, [this] { showOutputPane(); });
if (m_filesFailed > 0) {
const QString currentErrorText = m_infoBarWidget->errorText();
const QString newErrorText = makeLink(tr("Failed to analyze %n file(s).", nullptr,
m_filesFailed));
if (newErrorText != currentErrorText)
m_infoBarWidget->setError(InfoBarWidget::Warning, newErrorText,
[this] { showOutputPane(); });
}
// Info bar: info