mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
filter: introduce people- and tags-filtering in the mobile UI
Add a combo-box where the user can switch between "fulltext", "people" and "tags" filtering. Connect the combobox to the already existing filter-code. Dirk: make combo-box smaller by using a smaller font and restricting the width. Setting both maximum and preferred widths gives more consistent results. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c1e33aac21
commit
e0766aa4bd
5 changed files with 36 additions and 10 deletions
|
@ -207,13 +207,16 @@ void DiveListSortModel::setSourceModel(QAbstractItemModel *sourceModel)
|
|||
updateFilterState();
|
||||
}
|
||||
|
||||
void DiveListSortModel::setFilter(QString f)
|
||||
void DiveListSortModel::setFilter(QString f, FilterData::Mode mode)
|
||||
{
|
||||
f = f.trimmed();
|
||||
FilterData data;
|
||||
if (!f.isEmpty()) {
|
||||
data.mode = FilterData::Mode::FULLTEXT;
|
||||
data.fullText = f;
|
||||
data.mode = mode;
|
||||
if (mode == FilterData::Mode::FULLTEXT)
|
||||
data.fullText = f;
|
||||
else
|
||||
data.tags = f.split(",", QString::SkipEmptyParts);
|
||||
}
|
||||
DiveFilter::instance()->setFilter(data);
|
||||
CollapsedDiveListSortModel::instance()->updateFilterState();
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <QAbstractListModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "core/divefilter.h"
|
||||
#include "core/subsurface-qt/diveobjecthelper.h"
|
||||
|
||||
class CollapsedDiveListSortModel : public QSortFilterProxyModel
|
||||
|
@ -48,7 +49,7 @@ public:
|
|||
void updateFilterState();
|
||||
public slots:
|
||||
int getIdxForId(int id);
|
||||
void setFilter(QString f);
|
||||
void setFilter(QString f, FilterData::Mode mode);
|
||||
void resetFilter();
|
||||
int shown();
|
||||
protected:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue