ClangTools: Add expand/collapse button

Change-Id: I0981aeb4dad001eb561a4e83201ab21f3510b3e5
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2019-01-28 16:15:19 +01:00
parent 3f31dc6cef
commit c639964f92
2 changed files with 20 additions and 0 deletions

View File

@@ -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) {

View File

@@ -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")};
};