Introduce negate-toggle buttons to filter lists

Introduce toggle buttons which mean "filter all dives except
those fulfilling the selected criteria".

The old code used to check for rowCount() == 0. This should never happen,
because there is always a row "empty field". This check was moved into
the preamble of the functions to seperate it from the actual logic.

Fixes #435

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2017-12-24 14:35:59 +01:00 committed by Dirk Hohndel
parent b86c70ab2c
commit b6bf57a13b
4 changed files with 55 additions and 41 deletions

View file

@ -516,6 +516,7 @@ FilterBase::FilterBase(FilterModelBase *model_, QWidget *parent) : QWidget(paren
filter->setSourceModel(model);
filter->setFilterCaseSensitivity(Qt::CaseInsensitive);
connect(ui.filterInternalList, SIGNAL(textChanged(QString)), filter, SLOT(setFilterFixedString(QString)));
connect(ui.notButton, &QToolButton::toggled, model, &FilterModelBase::setNegate);
ui.filterList->setModel(filter);
addContextMenuEntry(tr("Select All"), &FilterModelBase::selectAll);