From b6bf57a13b5e4d3dd469b0fa8790d341eb4f1304 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 24 Dec 2017 14:35:59 +0100 Subject: 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 --- desktop-widgets/listfilter.ui | 10 ++++++++++ desktop-widgets/simplewidgets.cpp | 1 + 2 files changed, 11 insertions(+) (limited to 'desktop-widgets') diff --git a/desktop-widgets/listfilter.ui b/desktop-widgets/listfilter.ui index 48d813d21..b1d717bf0 100644 --- a/desktop-widgets/listfilter.ui +++ b/desktop-widgets/listfilter.ui @@ -51,6 +51,16 @@ + + + + ¬ + + + true + + + diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index b63349819..f8cd96943 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -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); -- cgit v1.2.3-70-g09d2