diff options
Diffstat (limited to 'examples/declarative/extending/attached/birthdayparty.h')
-rw-r--r-- | examples/declarative/extending/attached/birthdayparty.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/examples/declarative/extending/attached/birthdayparty.h b/examples/declarative/extending/attached/birthdayparty.h new file mode 100644 index 0000000..8249af5 --- /dev/null +++ b/examples/declarative/extending/attached/birthdayparty.h @@ -0,0 +1,45 @@ +#ifndef BIRTHDAYPARTY_H +#define BIRTHDAYPARTY_H + +#include <QObject> +#include <QDate> +#include <qml.h> +#include "person.h" + +class BirthdayPartyAttached : public QObject +{ +Q_OBJECT +Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp); +public: + BirthdayPartyAttached(QObject *object); + + QDate rsvp() const; + void setRsvp(const QDate &); + +private: + QDate m_rsvp; +}; +QML_DECLARE_TYPE(BirthdayPartyAttached); + +class BirthdayParty : public QObject +{ +Q_OBJECT +Q_PROPERTY(Person *celebrant READ celebrant WRITE setCelebrant) +Q_PROPERTY(QmlList<Person *> *guests READ guests) +Q_CLASSINFO("DefaultProperty", "guests") +public: + BirthdayParty(QObject *parent = 0); + + Person *celebrant() const; + void setCelebrant(Person *); + + QmlList<Person *> *guests(); + + static BirthdayPartyAttached *qmlAttachedProperties(QObject *); +private: + Person *m_celebrant; + QmlConcreteList<Person *> m_guests; +}; +QML_DECLARE_TYPE(BirthdayParty); + +#endif // BIRTHDAYPARTY_H |