This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
powersync-app/guh-control/models/rulesfiltermodel.h
2017-10-26 01:08:59 +02:00

40 lines
969 B
C++

#ifndef RULESFILTERMODEL_H
#define RULESFILTERMODEL_H
#include <QSortFilterProxyModel>
#include <QUuid>
class Rules;
class Rule;
class RulesFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
Q_PROPERTY(Rules* rules READ rules WRITE setRules NOTIFY rulesChanged)
Q_PROPERTY(QUuid filterEventDeviceId READ filterEventDeviceId WRITE setFilterEventDeviceId NOTIFY filterEventDeviceIdChanged)
public:
explicit RulesFilterModel(QObject *parent = nullptr);
Rules* rules() const;
void setRules(Rules* rules);
QUuid filterEventDeviceId() const;
void setFilterEventDeviceId(const QUuid &filterEventDeviceId);
Q_INVOKABLE Rule* get(int index) const;
signals:
void rulesChanged();
void filterEventDeviceIdChanged();
protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
private:
Rules *m_rules = nullptr;
QUuid m_filterEventDeviceId;
};
#endif // RULESFILTERMODEL_H