diff options
Diffstat (limited to 'examples/qml/referenceexamples/valuesource/person.h')
-rw-r--r-- | examples/qml/referenceexamples/valuesource/person.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/examples/qml/referenceexamples/valuesource/person.h b/examples/qml/referenceexamples/valuesource/person.h index 7283f39f61..ed77f8c4d8 100644 --- a/examples/qml/referenceexamples/valuesource/person.h +++ b/examples/qml/referenceexamples/valuesource/person.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -47,6 +47,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #ifndef PERSON_H #define PERSON_H @@ -63,7 +64,7 @@ class ShoeDescription : public QObject Q_PROPERTY(qreal price READ price WRITE setPrice) QML_ANONYMOUS public: - ShoeDescription(QObject *parent = nullptr); + using QObject::QObject; int size() const; void setSize(int); @@ -76,21 +77,24 @@ public: qreal price() const; void setPrice(qreal); + private: - int m_size; + int m_size = 0; QColor m_color; QString m_brand; - qreal m_price; + qreal m_price = 0; }; class Person : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) +// ![1] Q_PROPERTY(ShoeDescription *shoe READ shoe) +// ![1] QML_ANONYMOUS public: - Person(QObject *parent = nullptr); + using QObject::QObject; QString name() const; void setName(const QString &); @@ -106,7 +110,7 @@ class Boy : public Person Q_OBJECT QML_ELEMENT public: - Boy(QObject * parent = nullptr); + using Person::Person; }; class Girl : public Person @@ -114,7 +118,7 @@ class Girl : public Person Q_OBJECT QML_ELEMENT public: - Girl(QObject * parent = nullptr); + using Person::Person; }; #endif // PERSON_H |