diff options
Diffstat (limited to 'examples/declarative/extending/coercion/person.cpp')
-rw-r--r-- | examples/declarative/extending/coercion/person.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/examples/declarative/extending/coercion/person.cpp b/examples/declarative/extending/coercion/person.cpp new file mode 100644 index 0000000..4605db9 --- /dev/null +++ b/examples/declarative/extending/coercion/person.cpp @@ -0,0 +1,46 @@ +#include "person.h" + +Person::Person(QObject *parent) +: QObject(parent), m_shoeSize(0) +{ +} + +QString Person::name() const +{ + return m_name; +} + +void Person::setName(const QString &n) +{ + m_name = n; +} + +int Person::shoeSize() const +{ + return m_shoeSize; +} + +void Person::setShoeSize(int s) +{ + m_shoeSize = s; +} + +// ![0] +QML_DEFINE_NOCREATE_TYPE(Person); +// ![0] + +// ![1] +Boy::Boy(QObject * parent) +: Person(parent) +{ +} + +QML_DEFINE_TYPE(Boy, Boy); + +Girl::Girl(QObject * parent) +: Person(parent) +{ +} + +QML_DEFINE_TYPE(Girl, Girl); +// ![1] |