ClangTools: Adapt button state to checked fixits

"Apply Fixits" is disabled by default and enabled as soon as some fixits
are checked by the user.

Change-Id: I7e1345512b206f52d1e8628705c81c6b34dfb9ba
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-05-16 13:07:10 +02:00
parent 92103a25a3
commit f083293c31
3 changed files with 27 additions and 4 deletions

View File

@@ -161,6 +161,10 @@ ClangTidyClazyTool::ClangTidyClazyTool()
// Apply fixits button
m_applyFixitsButton = new QToolButton;
m_applyFixitsButton->setText(tr("Apply Fixits"));
m_applyFixitsButton->setEnabled(false);
connect(m_diagnosticModel,
&ClangToolsDiagnosticModel::fixItsToApplyCountChanged,
[this](int c) { m_applyFixitsButton->setEnabled(c); });
connect(m_applyFixitsButton, &QToolButton::clicked, [this]() {
QVector<Diagnostic> diagnosticsWithFixits;