diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-07 08:17:33 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-07-07 09:10:35 (GMT) |
commit | 6c901f67fb2f2e73fa362e72d985a04fa57cdf48 (patch) | |
tree | 583aab2bd1a6ccac33d310df3e8149da0aece0d5 /examples/declarative/extending/valuesource/person.cpp | |
parent | 131541866b374b90e04af75ec1382154c78b69b9 (diff) | |
download | Qt-6c901f67fb2f2e73fa362e72d985a04fa57cdf48.zip Qt-6c901f67fb2f2e73fa362e72d985a04fa57cdf48.tar.gz Qt-6c901f67fb2f2e73fa362e72d985a04fa57cdf48.tar.bz2 |
Doc
Diffstat (limited to 'examples/declarative/extending/valuesource/person.cpp')
-rw-r--r-- | examples/declarative/extending/valuesource/person.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/examples/declarative/extending/valuesource/person.cpp b/examples/declarative/extending/valuesource/person.cpp new file mode 100644 index 0000000..48a94e8 --- /dev/null +++ b/examples/declarative/extending/valuesource/person.cpp @@ -0,0 +1,83 @@ +#include "person.h" + +ShoeDescription::ShoeDescription(QObject *parent) +: QObject(parent), m_size(0), m_price(0) +{ +} + +int ShoeDescription::size() const +{ + return m_size; +} + +void ShoeDescription::setSize(int s) +{ + m_size = s; +} + +QColor ShoeDescription::color() const +{ + return m_color; +} + +void ShoeDescription::setColor(const QColor &c) +{ + m_color = c; +} + +QString ShoeDescription::brand() const +{ + return m_brand; +} + +void ShoeDescription::setBrand(const QString &b) +{ + m_brand = b; +} + +qreal ShoeDescription::price() const +{ + return m_price; +} + +void ShoeDescription::setPrice(qreal p) +{ + m_price = p; +} +QML_DEFINE_NOCREATE_TYPE(ShoeDescription); + +Person::Person(QObject *parent) +: QObject(parent) +{ +} + +QString Person::name() const +{ + return m_name; +} + +void Person::setName(const QString &n) +{ + m_name = n; +} + +ShoeDescription *Person::shoe() +{ + return &m_shoe; +} + +QML_DEFINE_NOCREATE_TYPE(Person); + +Boy::Boy(QObject * parent) +: Person(parent) +{ +} + +QML_DEFINE_TYPE(Boy, Boy); + +Girl::Girl(QObject * parent) +: Person(parent) +{ +} + +QML_DEFINE_TYPE(Girl, Girl); |