diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-09-12 17:03:52 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-01-13 16:47:57 +0100 |
commit | 2c3419e127e55810da1741725b4ff39f118cd577 (patch) | |
tree | 670ec93d28dadad06bd840a5694935ef8a7b2ac0 /examples/qml/referenceexamples/coercion | |
parent | 4eff7299501ff932071300b3fa34fbeccb03d0d8 (diff) |
Generate registrations for all examples
Now that we can generate all QML type information at build time, we
should also use it.
Change-Id: I647c72bbe38fdb2deb565b75c86a696af3d15b61
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'examples/qml/referenceexamples/coercion')
4 files changed, 7 insertions, 5 deletions
diff --git a/examples/qml/referenceexamples/coercion/birthdayparty.h b/examples/qml/referenceexamples/coercion/birthdayparty.h index 554e7ab0da..ba8b2445f1 100644 --- a/examples/qml/referenceexamples/coercion/birthdayparty.h +++ b/examples/qml/referenceexamples/coercion/birthdayparty.h @@ -60,6 +60,7 @@ class BirthdayParty : public QObject // ![0] Q_PROPERTY(Person *host READ host WRITE setHost) Q_PROPERTY(QQmlListProperty<Person> guests READ guests) + QML_ELEMENT // ![0] public: BirthdayParty(QObject *parent = nullptr); diff --git a/examples/qml/referenceexamples/coercion/coercion.pro b/examples/qml/referenceexamples/coercion/coercion.pro index 373a15fc28..225fd13e08 100644 --- a/examples/qml/referenceexamples/coercion/coercion.pro +++ b/examples/qml/referenceexamples/coercion/coercion.pro @@ -1,5 +1,9 @@ QT = core qml +CONFIG += qmltypes +QML_IMPORT_NAME = People +QML_IMPORT_MAJOR_VERSION = 1 + SOURCES += main.cpp \ person.cpp \ birthdayparty.cpp diff --git a/examples/qml/referenceexamples/coercion/main.cpp b/examples/qml/referenceexamples/coercion/main.cpp index 2c2bd92e8d..6b47d0d4c4 100644 --- a/examples/qml/referenceexamples/coercion/main.cpp +++ b/examples/qml/referenceexamples/coercion/main.cpp @@ -58,10 +58,6 @@ int main(int argc, char ** argv) { QCoreApplication app(argc, argv); - //![0] - qmlRegisterTypesAndRevisions<BirthdayParty, Person, Boy, Girl>("People", 1); - //![0] - QQmlEngine engine; QQmlComponent component(&engine, QUrl("qrc:example.qml")); auto *party = qobject_cast<BirthdayParty *>(component.create()); diff --git a/examples/qml/referenceexamples/coercion/person.h b/examples/qml/referenceexamples/coercion/person.h index 6865e0093a..7e2828da04 100644 --- a/examples/qml/referenceexamples/coercion/person.h +++ b/examples/qml/referenceexamples/coercion/person.h @@ -59,7 +59,8 @@ class Person : public QObject Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize) //![0] - QML_ANONYMOUS + QML_ELEMENT + QML_UNCREATABLE("Person is an abstract base class.") //![0] public: Person(QObject *parent = nullptr); |