summaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/binding/happybirthday.h
blob: fff2df04909d98def80decbf4dd38862c1cd7b5d (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>
#include <QmlMetaProperty>
#include <qml.h>

#include <QStringList>

class HappyBirthday : public QObject, public QmlPropertyValueSource
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
public:
    HappyBirthday(QObject *parent = 0);

    virtual void setTarget(const QmlMetaProperty &);

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

private slots:
    void advance();

signals:
    void nameChanged();
private:
    int m_line;
    QStringList m_lyrics;
    QmlMetaProperty m_target;
    QString m_name;
};
QML_DECLARE_TYPE(HappyBirthday);

#endif // HAPPYBIRTHDAY_H