summaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/coercion/person.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/extending/coercion/person.h')
-rw-r--r--examples/declarative/extending/coercion/person.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/examples/declarative/extending/coercion/person.h b/examples/declarative/extending/coercion/person.h
new file mode 100644
index 0000000..de14019
--- /dev/null
+++ b/examples/declarative/extending/coercion/person.h
@@ -0,0 +1,41 @@
+#ifndef PERSON_H
+#define PERSON_H
+
+#include <QObject>
+#include <qml.h>
+
+class Person : public QObject {
+Q_OBJECT
+Q_PROPERTY(QString name READ name WRITE setName)
+Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize)
+public:
+ Person(QObject *parent = 0);
+
+ QString name() const;
+ void setName(const QString &);
+
+ int shoeSize() const;
+ void setShoeSize(int);
+private:
+ QString m_name;
+ int m_shoeSize;
+};
+QML_DECLARE_TYPE(Person);
+
+// ![0]
+class Boy : public Person {
+Q_OBJECT
+public:
+ Boy(QObject * parent = 0);
+};
+QML_DECLARE_TYPE(Boy);
+
+class Girl : public Person {
+Q_OBJECT
+public:
+ Girl(QObject * parent = 0);
+};
+QML_DECLARE_TYPE(Girl);
+// ![0]
+
+#endif // PERSON_H