summaryrefslogtreecommitdiff
path: root/examples/qml/referenceexamples/binding/person.h
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2023-03-17 15:42:47 +0100
committerOlivier De Cannière <olivier.decanniere@qt.io>2023-03-30 18:02:16 +0200
commit405bd4299819e39397cea0090a9442fd4b6ce911 (patch)
treec1254e18a8ab47cc6bde048eb52ad0d89c2492c8 /examples/qml/referenceexamples/binding/person.h
parent03ff348b4942ae29dd5bc2bd563998d7ba82ecd7 (diff)
downloadqtdeclarative-405bd4299819e39397cea0090a9442fd4b6ce911.tar.gz
Doc: Revamp "Extending QML" examples into a tutorial
The examples in the "Extending QML" series were often redundant with the information of the "Writing QML Extensions with C++" tutorial, had outdated code and sometimes had no documentation. The examples that covered topics not mentioned in the first tutorial were revamped into a second "advanced" tutorial extending the first one. The others were removed. The remaining examples were largely based on the same example code of a birthday party. This code was slightly adapted and separated into 7 states, each building upon the previous, with the code change illustrating the associated feature. A tutorial page, in the style of the first one, was added documenting the different QML features and the required code changes in the example project. Links in the documentation from and to the affected pages were update as best as possible. Pick-to: 6.5 Fixes: QTBUG-111033 Change-Id: I9d97e8b32b128c1624d67525996fa14d493909d3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'examples/qml/referenceexamples/binding/person.h')
-rw-r--r--examples/qml/referenceexamples/binding/person.h84
1 files changed, 0 insertions, 84 deletions
diff --git a/examples/qml/referenceexamples/binding/person.h b/examples/qml/referenceexamples/binding/person.h
deleted file mode 100644
index 8314348bdf..0000000000
--- a/examples/qml/referenceexamples/binding/person.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef PERSON_H
-#define PERSON_H
-
-#include <QObject>
-#include <QColor>
-#include <QtQml/qqml.h>
-
-class ShoeDescription : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int size READ size WRITE setSize NOTIFY shoeChanged)
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY shoeChanged)
- Q_PROPERTY(QString brand READ brand WRITE setBrand NOTIFY shoeChanged)
- Q_PROPERTY(qreal price READ price WRITE setPrice NOTIFY shoeChanged)
- QML_ANONYMOUS
-public:
- using QObject::QObject;
-
- int size() const;
- void setSize(int);
-
- QColor color() const;
- void setColor(const QColor &);
-
- QString brand() const;
- void setBrand(const QString &);
-
- qreal price() const;
- void setPrice(qreal);
-
-signals:
- void shoeChanged();
-
-private:
- int m_size = 0;
- QColor m_color;
- QString m_brand;
- qreal m_price = 0;
-};
-
-class Person : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
-// ![0]
- Q_PROPERTY(ShoeDescription *shoe READ shoe CONSTANT)
-// ![0]
- QML_ANONYMOUS
-public:
- using QObject::QObject;
-
- QString name() const;
- void setName(const QString &);
-
- ShoeDescription *shoe();
-
-signals:
- void nameChanged();
-
-private:
- QString m_name;
- ShoeDescription m_shoe;
-};
-
-class Boy : public Person
-{
- Q_OBJECT
- QML_ELEMENT
-public:
- using Person::Person;
-};
-
-class Girl : public Person
-{
- Q_OBJECT
- QML_ELEMENT
-public:
- using Person::Person;
-};
-
-#endif // PERSON_H