diff options
Diffstat (limited to 'examples/qml/referenceexamples/methods')
-rw-r--r-- | examples/qml/referenceexamples/methods/main.cpp | 3 | ||||
-rw-r--r-- | examples/qml/referenceexamples/methods/person.h | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/examples/qml/referenceexamples/methods/main.cpp b/examples/qml/referenceexamples/methods/main.cpp index e2a1a28c8b..4dd616f8cd 100644 --- a/examples/qml/referenceexamples/methods/main.cpp +++ b/examples/qml/referenceexamples/methods/main.cpp @@ -58,8 +58,7 @@ int main(int argc, char ** argv) { QCoreApplication app(argc, argv); - qmlRegisterType<BirthdayParty>("People", 1,0, "BirthdayParty"); - qmlRegisterType<Person>("People", 1,0, "Person"); + qmlRegisterTypesAndRevisions<BirthdayParty, Person>("People", 1); QQmlEngine engine; QQmlComponent component(&engine, QUrl("qrc:example.qml")); diff --git a/examples/qml/referenceexamples/methods/person.h b/examples/qml/referenceexamples/methods/person.h index 749109dc72..2407fbb1b9 100644 --- a/examples/qml/referenceexamples/methods/person.h +++ b/examples/qml/referenceexamples/methods/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); |