forked from qt-creator/qt-creator
Add 'Check All Filter' action to filter menu
This commit is contained in:
committed by
Christian Stenger
parent
9394a43128
commit
1145febc05
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user