From 1145febc05559b47a54717264564e64ba5f8d41c Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 5 Nov 2014 15:40:37 +0100 Subject: [PATCH] Add 'Check All Filter' action to filter menu --- plugins/autotest/testresultmodel.h | 2 -- plugins/autotest/testresultspane.cpp | 20 ++++++++++++++++++-- plugins/autotest/testresultspane.h | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/plugins/autotest/testresultmodel.h b/plugins/autotest/testresultmodel.h index 95925bf4d0a..7618512fa26 100644 --- a/plugins/autotest/testresultmodel.h +++ b/plugins/autotest/testresultmodel.h @@ -50,8 +50,6 @@ public: int maxWidthOfFileName(const QFont &font); int maxWidthOfLineNumber(const QFont &font); - void enableAllResultTypes(); - void toggleTestResultType(ResultType type); bool hasResultType(ResultType type) { return m_availableResultTypes.contains(type); } int resultTypeCount(ResultType type); diff --git a/plugins/autotest/testresultspane.cpp b/plugins/autotest/testresultspane.cpp index c7e28bf8c79..e903aecffd8 100644 --- a/plugins/autotest/testresultspane.cpp +++ b/plugins/autotest/testresultspane.cpp @@ -288,6 +288,12 @@ void TestResultsPane::initializeFilterMenu() action->setData(result); m_filterMenu->addAction(action); } + m_filterMenu->addSeparator(); + QAction *action = new QAction(m_filterMenu); + action->setText(tr("Check All Filters")); + action->setCheckable(false); + m_filterMenu->addAction(action); + connect(action, &QAction::triggered, this, &TestResultsPane::enableAllFilter); } void TestResultsPane::updateSummaryLabel() @@ -310,11 +316,21 @@ void TestResultsPane::updateSummaryLabel() void TestResultsPane::updateFilterMenu() { foreach (QAction *action, m_filterMenu->actions()) { - action->setEnabled(m_model->hasResultType( - static_cast(action->data().value()))); + if (action->isCheckable()) + action->setEnabled(m_model->hasResultType( + static_cast(action->data().value()))); } } +void TestResultsPane::enableAllFilter() +{ + foreach (QAction *action, m_filterMenu->actions()) { + if (action->isCheckable()) + action->setChecked(true); + } + m_filterModel->enableAllResultTypes(); +} + void TestResultsPane::filterMenuTriggered(QAction *action) { m_filterModel->toggleTestResultType(static_cast(action->data().value())); diff --git a/plugins/autotest/testresultspane.h b/plugins/autotest/testresultspane.h index ea33c5f0e99..338eca79014 100644 --- a/plugins/autotest/testresultspane.h +++ b/plugins/autotest/testresultspane.h @@ -79,6 +79,7 @@ private slots: void onRunAllTriggered(); void onRunSelectedTriggered(); void updateFilterMenu(); + void enableAllFilter(); void filterMenuTriggered(QAction *action); private: