aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/referenceexamples/adding
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml/referenceexamples/adding')
-rw-r--r--examples/qml/referenceexamples/adding/main.cpp4
-rw-r--r--examples/qml/referenceexamples/adding/person.h3
2 files changed, 5 insertions, 2 deletions
diff --git a/examples/qml/referenceexamples/adding/main.cpp b/examples/qml/referenceexamples/adding/main.cpp
index e312149da1..ffd0e90c42 100644
--- a/examples/qml/referenceexamples/adding/main.cpp
+++ b/examples/qml/referenceexamples/adding/main.cpp
@@ -57,7 +57,7 @@ int main(int argc, char ** argv)
{
QCoreApplication app(argc, argv);
//![0]
- qmlRegisterType<Person>("People", 1,0, "Person");
+ qmlRegisterTypesAndRevisions<Person>("People", 1);
//![0]
QQmlEngine engine;
@@ -70,5 +70,5 @@ int main(int argc, char ** argv)
qWarning() << component.errors();
}
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/examples/qml/referenceexamples/adding/person.h b/examples/qml/referenceexamples/adding/person.h
index f40c8d8086..530c335dee 100644
--- a/examples/qml/referenceexamples/adding/person.h
+++ b/examples/qml/referenceexamples/adding/person.h
@@ -51,12 +51,15 @@
#define PERSON_H
#include <QObject>
+#include <QtQml/qqml.h>
+
//![0]
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);