-
Notifications
You must be signed in to change notification settings - Fork 75
/
qffilter.h
57 lines (41 loc) · 1.25 KB
/
qffilter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef QFFILTER_H
#define QFFILTER_H
#include <QObject>
#include <QQmlParserStatus>
#include <QJSValue>
#include <QVariant>
#include <QQmlListProperty>
#include <QQmlEngine>
#include <QPointer>
// Filter represents a filter rule in AppListener
class QFFilter : public QObject, public QQmlParserStatus
{
Q_OBJECT
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(QStringList types READ types WRITE setTypes NOTIFY typesChanged)
Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QQmlListProperty<QObject> __children READ children)
Q_CLASSINFO("DefaultProperty", "__children")
public:
explicit QFFilter(QObject *parent = 0);
QString type() const;
void setType(const QString &type);
QStringList types() const;
void setTypes(const QStringList &types);
QQmlListProperty<QObject> children();
signals:
void dispatched(QString type, QJSValue message);
void typeChanged();
void typesChanged();
protected:
void classBegin();
void componentComplete();
private slots:
void filter(QString type, QJSValue message);
void filter(QString type, QVariant message);
private:
QStringList m_types;
QList<QObject*> m_children;
QPointer<QQmlEngine> m_engine;
};
#endif // QFFILTER_H