mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Mobile/filtering: roll our own filtering for performance reasons
The regular expression based generic filtering made things very slow on a cell phone or other, slower device. With this the results seem more reasonable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
51e7603d7e
commit
6248ddf529
2 changed files with 49 additions and 11 deletions
|
|
@ -12,6 +12,7 @@ class DiveListSortModel : public QSortFilterProxyModel
|
|||
Q_OBJECT
|
||||
public:
|
||||
DiveListSortModel(QObject *parent = 0);
|
||||
void setSourceModel(QAbstractItemModel *sourceModel);
|
||||
Q_INVOKABLE void addAllDives();
|
||||
Q_INVOKABLE void clear();
|
||||
public slots:
|
||||
|
|
@ -20,6 +21,12 @@ public slots:
|
|||
void setFilter(QString f);
|
||||
void resetFilter();
|
||||
int shown();
|
||||
protected:
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
|
||||
private:
|
||||
std::vector<unsigned char> filteredRows; // using unsigned char because using 'bool' turns this into a bitfield
|
||||
QString filterString;
|
||||
void updateFilterState();
|
||||
};
|
||||
|
||||
class DiveListModel : public QAbstractListModel
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue