diff --git a/src/plugins/clangtools/clangtidyclazytool.cpp b/src/plugins/clangtools/clangtidyclazytool.cpp index 1cf0c81fa4b..d7033df170d 100644 --- a/src/plugins/clangtools/clangtidyclazytool.cpp +++ b/src/plugins/clangtools/clangtidyclazytool.cpp @@ -260,6 +260,23 @@ ClangTidyClazyTool::ClangTidyClazyTool() }); m_clear = action; + // Expand/Collapse + action = new QAction(this); + action->setDisabled(true); + action->setCheckable(true); + action->setIcon(Utils::Icons::EXPAND_ALL_TOOLBAR.icon()); + action->setToolTip(tr("Expand All")); + connect(action, &QAction::toggled, [this](bool checked){ + if (checked) { + m_expandCollapse->setToolTip(tr("Collapse All")); + m_diagnosticView->expandAll(); + } else { + m_expandCollapse->setToolTip(tr("Expand All")); + m_diagnosticView->collapseAll(); + } + }); + m_expandCollapse = action; + // Filter line edit m_filterLineEdit = new Utils::FancyLineEdit(); m_filterLineEdit->setFiltering(true); @@ -310,6 +327,7 @@ ClangTidyClazyTool::ClangTidyClazyTool() m_perspective.addToolBarAction(m_clear); m_perspective.addToolBarAction(m_goBack); m_perspective.addToolBarAction(m_goNext); + m_perspective.addToolBarAction(m_expandCollapse); m_perspective.addToolBarWidget(m_filterLineEdit); m_perspective.addToolBarWidget(m_applyFixitsButton); @@ -426,6 +444,7 @@ void ClangTidyClazyTool::handleStateUpdate() const int issuesVisible = m_diagnosticFilterModel->rowCount(); m_goBack->setEnabled(issuesVisible > 1); m_goNext->setEnabled(issuesVisible > 1); + m_expandCollapse->setEnabled(issuesVisible); QString message; if (m_running) { diff --git a/src/plugins/clangtools/clangtidyclazytool.h b/src/plugins/clangtools/clangtidyclazytool.h index a82ff809993..7cde29f89d7 100644 --- a/src/plugins/clangtools/clangtidyclazytool.h +++ b/src/plugins/clangtools/clangtidyclazytool.h @@ -71,6 +71,7 @@ private: QAction *m_goBack = nullptr; QAction *m_goNext = nullptr; QAction *m_clear = nullptr; + QAction *m_expandCollapse = nullptr; Utils::Perspective m_perspective{ClangTidyClazyPerspectiveId, tr("Clang-Tidy and Clazy")}; };