fuzbal/event_filter.h
Timotej Lazar 8d44150598
Implement filter
Add a proxy model class with filter logic, and use it as the model for
events ListView.
2021-09-16 20:33:33 +02:00

25 lines
469 B
C++

#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