Commit 1145febc authored by Christian Stenger's avatar Christian Stenger Committed by Christian Stenger
Browse files

Add 'Check All Filter' action to filter menu

parent 9394a431
......@@ -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);
......
......@@ -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<ResultType>(action->data().value<int>())));
if (action->isCheckable())
action->setEnabled(m_model->hasResultType(
static_cast<ResultType>(action->data().value<int>())));
}
}
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<ResultType>(action->data().value<int>()));
......
......@@ -79,6 +79,7 @@ private slots:
void onRunAllTriggered();
void onRunSelectedTriggered();
void updateFilterMenu();
void enableAllFilter();
void filterMenuTriggered(QAction *action);
private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment