aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/scenegraph/openglunderqml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/scenegraph/openglunderqml')
-rw-r--r--examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc5
-rw-r--r--examples/quick/scenegraph/openglunderqml/main.cpp2
-rw-r--r--examples/quick/scenegraph/openglunderqml/openglunderqml.pro4
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.h1
4 files changed, 7 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 022d6a75bb..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);
- qmlRegisterType<Squircle>("OpenGLUnderQML", 1, 0, "Squircle");
-
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
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.h b/examples/quick/scenegraph/openglunderqml/squircle.h
index 1b9995bc1e..c24fdd50c2 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.h
+++ b/examples/quick/scenegraph/openglunderqml/squircle.h
@@ -86,6 +86,7 @@ class Squircle : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(qreal t READ t WRITE setT NOTIFY tChanged)
+ QML_ELEMENT
public:
Squircle();