summaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/valuesource/happybirthday.h
blob: 18ac1f4de49a0ccc3f9903f70f4ae43c2fad51e1 (plain)
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
#ifndef HAPPYBIRTHDAY_H
#define HAPPYBIRTHDAY_H

#include <QmlPropertyValueSource>
#include <qml.h>

#include <QStringList>

// ![0]
class HappyBirthday : public QObject, public QmlPropertyValueSource
{
Q_OBJECT
// ![0]
Q_PROPERTY(QString name READ name WRITE setName)
// ![1]
public:
    HappyBirthday(QObject *parent = 0);

    virtual void setTarget(const QmlMetaProperty &);
// ![1]

    QString name() const;
    void setName(const QString &);

private slots:
    void advance();

private:
    int m_line;
    QStringList m_lyrics;
    QmlMetaProperty m_target;
    QString m_name;
// ![2]
};
// ![2]
QML_DECLARE_TYPE(HappyBirthday);

#endif // HAPPYBIRTHDAY_H