diff options
Diffstat (limited to 'examples/qml/referenceexamples/properties')
-rw-r--r-- | examples/qml/referenceexamples/properties/main.cpp | 9 | ||||
-rw-r--r-- | examples/qml/referenceexamples/properties/person.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/examples/qml/referenceexamples/properties/main.cpp b/examples/qml/referenceexamples/properties/main.cpp index a0a2335034..216869bf6c 100644 --- a/examples/qml/referenceexamples/properties/main.cpp +++ b/examples/qml/referenceexamples/properties/main.cpp @@ -59,8 +59,7 @@ int main(int argc, char ** argv) QCoreApplication app(argc, argv); //![register list] - qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty"); - qmlRegisterType<Person>("People", 1,0, "Person"); + qmlRegisterTypesAndRevisions<BirthdayParty, Person>("People", 1); //![register list] QQmlEngine engine; @@ -72,9 +71,9 @@ int main(int argc, char ** argv) qWarning() << "They are inviting:"; for (int ii = 0; ii < party->guestCount(); ++ii) qWarning() << " " << party->guest(ii)->name(); - } else { - qWarning() << component.errors(); + return EXIT_SUCCESS; } - return 0; + qWarning() << component.errors(); + return EXIT_FAILURE; } diff --git a/examples/qml/referenceexamples/properties/person.h b/examples/qml/referenceexamples/properties/person.h index 749109dc72..2407fbb1b9 100644 --- a/examples/qml/referenceexamples/properties/person.h +++ b/examples/qml/referenceexamples/properties/person.h @@ -51,12 +51,14 @@ #define PERSON_H #include <QObject> +#include <QtQml/qqml.h> class Person : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize) + QML_ELEMENT public: Person(QObject *parent = nullptr); |