diff options
Diffstat (limited to 'examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/person.cpp')
-rw-r--r-- | examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/person.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/person.cpp b/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/person.cpp new file mode 100644 index 0000000000..f8f4b1d2f4 --- /dev/null +++ b/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/person.cpp @@ -0,0 +1,30 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include "person.h" + +QString Person::name() const +{ + return m_name; +} + +void Person::setName(const QString &name) +{ + if (m_name != name) { + m_name = name; + emit nameChanged(); + } +} + +int Person::shoeSize() const +{ + return m_shoeSize; +} + +void Person::setShoeSize(int shoeSize) +{ + if (m_shoeSize != shoeSize) { + m_shoeSize = shoeSize; + emit shoeSizeChanged(); + } +} |