Add select-all, deselect-all and invert-selection options to filters

To every filter list add a menu button that allows selection of all,
selection of none or inversion of selection.

Implements #435.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2017-12-23 15:49:21 +01:00 committed by Dirk Hohndel
parent 668635e98e
commit 7451517e4a
4 changed files with 33 additions and 0 deletions

View file

@ -100,6 +100,21 @@ void FilterModelBase::clearFilter()
emit dataChanged(createIndex(0,0), createIndex(rowCount()-1, 0));
}
void FilterModelBase::selectAll()
{
std::fill(checkState.begin(), checkState.end(), true);
anyChecked = true;
emit dataChanged(createIndex(0,0), createIndex(rowCount()-1, 0));
}
void FilterModelBase::invertSelection()
{
for (char &b: checkState)
b = !b;
anyChecked = std::any_of(checkState.begin(), checkState.end(), [](char b){return !!b;});
emit dataChanged(createIndex(0,0), createIndex(rowCount()-1, 0));
}
SuitsFilterModel::SuitsFilterModel(QObject *parent) : FilterModelBase(parent)
{
}