2022-05-13 13:12:05 +00:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2021-11-23 18:00:29 +00:00
|
|
|
|
|
|
|
#include "person.h"
|
|
|
|
|
2022-03-21 09:21:18 +00:00
|
|
|
using namespace Qt::StringLiterals;
|
|
|
|
|
2021-11-23 18:00:29 +00:00
|
|
|
Person::Person(QObject *parent)
|
2022-03-21 09:21:18 +00:00
|
|
|
: QObject(parent), m_name(u"Bart"_s), m_shoeSize(0)
|
2021-11-23 18:00:29 +00:00
|
|
|
{
|
2022-03-21 09:21:18 +00:00
|
|
|
m_things.append(u"thing"_s);
|
2022-01-05 12:53:20 +00:00
|
|
|
m_things.append(30);
|
2021-11-23 18:00:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
2022-03-21 09:21:18 +00:00
|
|
|
setName(u"Bart"_s);
|
2021-11-23 18:00:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int Person::shoeSize() const
|
|
|
|
{
|
|
|
|
return m_shoeSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person::setShoeSize(int s)
|
|
|
|
{
|
|
|
|
if (s != m_shoeSize) {
|
|
|
|
m_shoeSize = s;
|
|
|
|
emit shoeSizeChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-05 12:53:20 +00:00
|
|
|
QVariantList Person::things() const
|
|
|
|
{
|
|
|
|
return m_things;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Person::setThings(const QVariantList &things)
|
|
|
|
{
|
|
|
|
if (m_things == things)
|
|
|
|
return;
|
|
|
|
m_things = things;
|
|
|
|
emit thingsChanged();
|
|
|
|
}
|
2022-07-04 15:31:22 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|