blob: 946dfbcdaa23d6f1f3aa325c19157d2f8a8a8e8e (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "person.h"
using namespace Qt::StringLiterals;
Person::Person(QObject *parent)
: QObject(parent), m_name(u"Bart"_s), m_shoeSize(0)
{
m_things.append(u"thing"_s);
m_things.append(30);
}
QString Person::name() const
{
return m_name;
}
void Person::setName(const QString &n)
{
if (n != m_name) {
m_name = n;
emit nameChanged();
}
}
void Person::resetName()
{
setName(u"Bart"_s);
}
int Person::shoeSize() const
{
return m_shoeSize;
}
void Person::setShoeSize(int s)
{
if (s != m_shoeSize) {
m_shoeSize = s;
emit shoeSizeChanged();
}
}
QVariantList Person::things() const
{
return m_things;
}
void Person::setThings(const QVariantList &things)
{
if (m_things == things)
return;
m_things = things;
emit thingsChanged();
}
QList<Barzle *> Person::barzles() const
{
return m_barzles;
}
void Person::setBarzles(const QList<Barzle *> &barzles)
{
if (m_barzles == barzles)
return;
m_barzles = barzles;
emit barzlesChanged();
}
QBindable<QByteArray> Person::dataBindable()
{
return QBindable<QByteArray>(&m_data);
}
void Person::setData(const QByteArray &data)
{
if (data != m_data.value())
emit dataChanged();
m_data.setValue(data);
}
QByteArray Person::data() const
{
return m_data;
}
QList<Person *> Person::cousins() const
{
return m_cousins;
}
void Person::setCousins(const QList<Person *> &newCousins)
{
if (m_cousins == newCousins)
return;
m_cousins = newCousins;
emit cousinsChanged();
}
QRectF Person::area() const
{
return m_area;
}
void Person::setArea(const QRectF &newArea)
{
if (m_area.valueBypassingBindings() == newArea)
return;
m_area = newArea;
emit areaChanged();
}
QBindable<QRectF> Person::areaBindable()
{
return QBindable<QRectF>(&m_area);
}
|