summaryrefslogtreecommitdiff
path: root/event_filter.h
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.si>2021-09-05 21:16:46 +0200
committerTimotej Lazar <timotej.lazar@araneo.si>2021-09-16 20:33:33 +0200
commit8d44150598a4e04a751b7df0d8c91ea29099e10e (patch)
tree7ff80ba2ea06bd8fa7b1bd0b61298cf86c0f3b85 /event_filter.h
parentcb76fedcbc8e419e2b945baa56ac3f986a9e79a3 (diff)
Implement filter
Add a proxy model class with filter logic, and use it as the model for events ListView.
Diffstat (limited to 'event_filter.h')
-rw-r--r--event_filter.h25
1 files changed, 25 insertions, 0 deletions
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 <QList>
+#include <QPair>
+#include <QSortFilterProxyModel>
+#include <QString>
+#include <qqml.h>
+
+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<QPair<QString, QString>> filters;
+};
+
+#endif