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/quick/scenegraph/openglunderqml | |
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/quick/scenegraph/openglunderqml')
3 files changed, 6 insertions, 5 deletions
diff --git a/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc b/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc index 9676815c44..c2944970a5 100644 --- a/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc +++ b/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc @@ -60,6 +60,7 @@ First of all, we need an object we can expose to QML. This is a subclass of QQuickItem so we can easily access \l QQuickItem::window(). + We expose it to QML using the QML_ELEMENT macro. \snippet scenegraph/openglunderqml/squircle.h 1 @@ -145,9 +146,7 @@ \snippet scenegraph/openglunderqml/main.cpp 1 The application's \c main() function instantiates a QQuickView and - launches the \c main.qml file. The only thing worth noting is that - we export the \c Squircle class to QML using the \l - qmlRegisterType() macro. + launches the \c main.qml file. \snippet scenegraph/openglunderqml/main.qml 1 diff --git a/examples/quick/scenegraph/openglunderqml/main.cpp b/examples/quick/scenegraph/openglunderqml/main.cpp index c04d0da68f..4ca8d05f1c 100644 --- a/examples/quick/scenegraph/openglunderqml/main.cpp +++ b/examples/quick/scenegraph/openglunderqml/main.cpp @@ -59,8 +59,6 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); - qmlRegisterTypesAndRevisions<Squircle>("OpenGLUnderQML", 1); - QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); view.setSource(QUrl("qrc:///scenegraph/openglunderqml/main.qml")); diff --git a/examples/quick/scenegraph/openglunderqml/openglunderqml.pro b/examples/quick/scenegraph/openglunderqml/openglunderqml.pro index 54558ce9e9..7eaace1133 100644 --- a/examples/quick/scenegraph/openglunderqml/openglunderqml.pro +++ b/examples/quick/scenegraph/openglunderqml/openglunderqml.pro @@ -1,5 +1,9 @@ QT += qml quick +CONFIG += qmltypes +QML_IMPORT_NAME = OpenGLUnderQML +QML_IMPORT_MAJOR_VERSION = 1 + HEADERS += squircle.h SOURCES += squircle.cpp main.cpp RESOURCES += openglunderqml.qrc |