From 8d44150598a4e04a751b7df0d8c91ea29099e10e Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 5 Sep 2021 21:16:46 +0200 Subject: Implement filter Add a proxy model class with filter logic, and use it as the model for events ListView. --- event_filter.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 event_filter.h (limited to 'event_filter.h') diff --git a/event_filter.h b/event_filter.h new file mode 100644 index 0000000..aca6ed9 --- /dev/null +++ b/event_filter.h @@ -0,0 +1,25 @@ +#ifndef EVENT_FILTER_H +#define EVENT_FILTER_H + +#include +#include +#include +#include +#include + +class EventFilter : public QSortFilterProxyModel +{ + Q_OBJECT + QML_ELEMENT +public slots: + void setFilter(const QString& filter = ""); + bool remove(int row); + +protected: + bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override; + +private: + QList> filters; +}; + +#endif -- cgit v1.3