diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2017-12-23 15:49:21 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-12-24 08:24:11 -0800 |
commit | 7451517e4a5e9aeffe31f1cd7346b07c0c9e15ac (patch) | |
tree | 328e5aa5c0bb922640a53a2cc54546f36dfa79ec /desktop-widgets | |
parent | 668635e98eb32e3c5ffd3cb3e65da51c71db2975 (diff) | |
download | subsurface-7451517e4a5e9aeffe31f1cd7346b07c0c9e15ac.tar.gz |
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>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/listfilter.ui | 10 | ||||
-rw-r--r-- | desktop-widgets/simplewidgets.cpp | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/desktop-widgets/listfilter.ui b/desktop-widgets/listfilter.ui index 48d813d21..dcdcd932e 100644 --- a/desktop-widgets/listfilter.ui +++ b/desktop-widgets/listfilter.ui @@ -51,6 +51,16 @@ </property> </widget> </item> + <item> + <widget class="QToolButton" name="selectionButton"> + <property name="text"> + <string>...</string> + </property> + <property name="popupMode"> + <enum>QToolButton::InstantPopup</enum> + </property> + </widget> + </item> </layout> </item> <item> diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index addbda6af..86ea1fbc0 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -513,6 +513,12 @@ FilterBase::FilterBase(FilterModelBase *model_, QWidget *parent) filter->setFilterCaseSensitivity(Qt::CaseInsensitive); connect(ui.filterInternalList, SIGNAL(textChanged(QString)), filter, SLOT(setFilterFixedString(QString))); ui.filterList->setModel(filter); + + QMenu *menu = new QMenu(this); + menu->addAction(tr("Select All"), model, &FilterModelBase::selectAll); + menu->addAction(tr("Unselect All"), model, &FilterModelBase::clearFilter); + menu->addAction(tr("Invert Selection"), model, &FilterModelBase::invertSelection); + ui.selectionButton->setMenu(menu); } void FilterBase::showEvent(QShowEvent *event) |