aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-12-24 14:35:59 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-12-26 13:08:49 -0800
commitb6bf57a13b5e4d3dd469b0fa8790d341eb4f1304 (patch)
treee57922eee99f54276adec54d4f277c8f26e1d1ab /desktop-widgets
parentb86c70ab2ce91c46355a71008334aa6743caa1e6 (diff)
downloadsubsurface-b6bf57a13b5e4d3dd469b0fa8790d341eb4f1304.tar.gz
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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/listfilter.ui10
-rw-r--r--desktop-widgets/simplewidgets.cpp1
2 files changed, 11 insertions, 0 deletions
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 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QToolButton" name="notButton">
+ <property name="text">
+ <string>¬</string>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
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);