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

#include <QmlPropertyValueSource>

// ![0]
class HappyBirthday : 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