summaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/coercion/person.cpp
blob: 4605db99bfafdc4a0c49564edc3948fa9fc7eb21 (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
37
38
39
40
41
42
43
44
45
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]