aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/scenegraph
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-08-21 18:34:21 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-09-26 12:32:17 +0200
commitcc1a604c704f848927b3fa0a97b0a50b0b79d2a4 (patch)
tree610ece713eba021c8e5a3d248f54a62370e810f8 /examples/quick/scenegraph
parent531cf90305ae50920b2e597dd0758fdb82ad88b0 (diff)
Specify parameters of type registration in class declarations
Using this technique we can automatically register all necessary revisions and minor versions of a type, using the metaobject system. This greatly reduces the potential for mistakes and resulting incompatibilities between versions of imports. We assume that for each type we need to register all revisions of its super types and its attached type, and that the revisions match. That is, if you import version X of type A, you will also get version X of its attached type and of any super types. As we previously didn't take these dependencies into account when manually registering the types, a number of extra revisions are now registered for some types. Potentially, we can now generate the qmltypes files at compile time, using moc. Change-Id: I7abb8a5c39f5e63ad1a0cb41a783f2c91909491b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'examples/quick/scenegraph')
-rw-r--r--examples/quick/scenegraph/customgeometry/beziercurve.h1
-rw-r--r--examples/quick/scenegraph/customgeometry/main.cpp2
-rw-r--r--examples/quick/scenegraph/d3d11underqml/d3d11squircle.h1
-rw-r--r--examples/quick/scenegraph/d3d11underqml/main.cpp2
-rw-r--r--examples/quick/scenegraph/graph/graph.h1
-rw-r--r--examples/quick/scenegraph/graph/main.cpp2
-rw-r--r--examples/quick/scenegraph/metalunderqml/main.cpp2
-rw-r--r--examples/quick/scenegraph/metalunderqml/metalsquircle.h1
-rw-r--r--examples/quick/scenegraph/openglunderqml/main.cpp2
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.h1
-rw-r--r--examples/quick/scenegraph/rendernode/customrenderitem.h1
-rw-r--r--examples/quick/scenegraph/rendernode/main.cpp2
-rw-r--r--examples/quick/scenegraph/simplematerial/simplematerial.cpp3
-rw-r--r--examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.h1
-rw-r--r--examples/quick/scenegraph/textureinsgnode/main.cpp2
-rw-r--r--examples/quick/scenegraph/textureinthread/main.cpp2
-rw-r--r--examples/quick/scenegraph/textureinthread/threadrenderer.h1
-rw-r--r--examples/quick/scenegraph/threadedanimation/main.cpp2
-rw-r--r--examples/quick/scenegraph/threadedanimation/spinner.h1
-rw-r--r--examples/quick/scenegraph/twotextureproviders/main.cpp2
-rw-r--r--examples/quick/scenegraph/twotextureproviders/xorblender.h1
21 files changed, 22 insertions, 11 deletions
diff --git a/examples/quick/scenegraph/customgeometry/beziercurve.h b/examples/quick/scenegraph/customgeometry/beziercurve.h
index f2f7832e6d..be9e4ef49f 100644
--- a/examples/quick/scenegraph/customgeometry/beziercurve.h
+++ b/examples/quick/scenegraph/customgeometry/beziercurve.h
@@ -64,6 +64,7 @@ class BezierCurve : public QQuickItem
Q_PROPERTY(QPointF p4 READ p4 WRITE setP4 NOTIFY p4Changed)
Q_PROPERTY(int segmentCount READ segmentCount WRITE setSegmentCount NOTIFY segmentCountChanged)
+ QML_ELEMENT
public:
BezierCurve(QQuickItem *parent = 0);
diff --git a/examples/quick/scenegraph/customgeometry/main.cpp b/examples/quick/scenegraph/customgeometry/main.cpp
index 6f3c24e87b..9352e4bd24 100644
--- a/examples/quick/scenegraph/customgeometry/main.cpp
+++ b/examples/quick/scenegraph/customgeometry/main.cpp
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- qmlRegisterType<BezierCurve>("CustomGeometry", 1, 0, "BezierCurve");
+ qmlRegisterTypesAndRevisions<BezierCurve>("CustomGeometry", 1);
QQuickView view;
QSurfaceFormat format = view.format();
diff --git a/examples/quick/scenegraph/d3d11underqml/d3d11squircle.h b/examples/quick/scenegraph/d3d11underqml/d3d11squircle.h
index be9aadc43b..4be3671d1c 100644
--- a/examples/quick/scenegraph/d3d11underqml/d3d11squircle.h
+++ b/examples/quick/scenegraph/d3d11underqml/d3d11squircle.h
@@ -59,6 +59,7 @@ class D3D11Squircle : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(qreal t READ t WRITE setT NOTIFY tChanged)
+ QML_ELEMENT
public:
D3D11Squircle();
diff --git a/examples/quick/scenegraph/d3d11underqml/main.cpp b/examples/quick/scenegraph/d3d11underqml/main.cpp
index d26de1144a..dcab8c879c 100644
--- a/examples/quick/scenegraph/d3d11underqml/main.cpp
+++ b/examples/quick/scenegraph/d3d11underqml/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- qmlRegisterType<D3D11Squircle>("D3D11UnderQML", 1, 0, "D3D11Squircle");
+ qmlRegisterTypesAndRevisions<D3D11Squircle>("D3D11UnderQML", 1);
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Direct3D11Rhi);
diff --git a/examples/quick/scenegraph/graph/graph.h b/examples/quick/scenegraph/graph/graph.h
index a1a00cb6dc..e32e657e0e 100644
--- a/examples/quick/scenegraph/graph/graph.h
+++ b/examples/quick/scenegraph/graph/graph.h
@@ -56,6 +56,7 @@
class Graph : public QQuickItem
{
Q_OBJECT
+ QML_ELEMENT
public:
Graph();
diff --git a/examples/quick/scenegraph/graph/main.cpp b/examples/quick/scenegraph/graph/main.cpp
index 2406457ab5..9a575944b9 100644
--- a/examples/quick/scenegraph/graph/main.cpp
+++ b/examples/quick/scenegraph/graph/main.cpp
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
{
QGuiApplication a(argc, argv);
- qmlRegisterType<Graph>("Graph", 1, 0, "Graph");
+ qmlRegisterTypesAndRevisions<Graph>("Graph", 1);
QQuickView view;
view.resize(800, 400);
diff --git a/examples/quick/scenegraph/metalunderqml/main.cpp b/examples/quick/scenegraph/metalunderqml/main.cpp
index 5ad337abb1..3e620137cd 100644
--- a/examples/quick/scenegraph/metalunderqml/main.cpp
+++ b/examples/quick/scenegraph/metalunderqml/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- qmlRegisterType<MetalSquircle>("MetalUnderQML", 1, 0, "MetalSquircle");
+ qmlRegisterTypesAndRevisions<MetalSquircle>("MetalUnderQML", 1);
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::MetalRhi);
diff --git a/examples/quick/scenegraph/metalunderqml/metalsquircle.h b/examples/quick/scenegraph/metalunderqml/metalsquircle.h
index 43c4afad21..18db7d45f3 100644
--- a/examples/quick/scenegraph/metalunderqml/metalsquircle.h
+++ b/examples/quick/scenegraph/metalunderqml/metalsquircle.h
@@ -59,6 +59,7 @@ class MetalSquircle : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(qreal t READ t WRITE setT NOTIFY tChanged)
+ QML_ELEMENT
public:
MetalSquircle();
diff --git a/examples/quick/scenegraph/openglunderqml/main.cpp b/examples/quick/scenegraph/openglunderqml/main.cpp
index 022d6a75bb..c04d0da68f 100644
--- a/examples/quick/scenegraph/openglunderqml/main.cpp
+++ b/examples/quick/scenegraph/openglunderqml/main.cpp
@@ -59,7 +59,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- qmlRegisterType<Squircle>("OpenGLUnderQML", 1, 0, "Squircle");
+ qmlRegisterTypesAndRevisions<Squircle>("OpenGLUnderQML", 1);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
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();
diff --git a/examples/quick/scenegraph/rendernode/customrenderitem.h b/examples/quick/scenegraph/rendernode/customrenderitem.h
index a0ac3468e4..74115b2505 100644
--- a/examples/quick/scenegraph/rendernode/customrenderitem.h
+++ b/examples/quick/scenegraph/rendernode/customrenderitem.h
@@ -56,6 +56,7 @@
class CustomRenderItem : public QQuickItem
{
Q_OBJECT
+ QML_ELEMENT
public:
CustomRenderItem(QQuickItem *parent = nullptr);
diff --git a/examples/quick/scenegraph/rendernode/main.cpp b/examples/quick/scenegraph/rendernode/main.cpp
index 146d787e50..b1dfe47829 100644
--- a/examples/quick/scenegraph/rendernode/main.cpp
+++ b/examples/quick/scenegraph/rendernode/main.cpp
@@ -59,7 +59,7 @@ int main(int argc, char **argv)
QGuiApplication app(argc, argv);
//! [1]
- qmlRegisterType<CustomRenderItem>("SceneGraphRendering", 2, 0, "CustomRenderItem");
+ qmlRegisterTypesAndRevisions<CustomRenderItem>("SceneGraphRendering", 2);
//! [1]
QQuickView view;
diff --git a/examples/quick/scenegraph/simplematerial/simplematerial.cpp b/examples/quick/scenegraph/simplematerial/simplematerial.cpp
index 6773b6fb5a..55e1d879ca 100644
--- a/examples/quick/scenegraph/simplematerial/simplematerial.cpp
+++ b/examples/quick/scenegraph/simplematerial/simplematerial.cpp
@@ -157,6 +157,7 @@ class Item : public QQuickItem
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ QML_NAMED_ELEMENT(SimpleMaterialItem)
public:
@@ -203,7 +204,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- qmlRegisterType<Item>("SimpleMaterial", 1, 0, "SimpleMaterialItem");
+ qmlRegisterTypesAndRevisions<Item>("SimpleMaterial", 1);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.h b/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.h
index e1a9ce22c8..1b92b56851 100644
--- a/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.h
+++ b/examples/quick/scenegraph/textureinsgnode/fboinsgrenderer.h
@@ -58,6 +58,7 @@ class LogoRenderer;
class FboInSGRenderer : public QQuickFramebufferObject
{
Q_OBJECT
+ QML_NAMED_ELEMENT(Renderer)
public:
Renderer *createRenderer() const;
};
diff --git a/examples/quick/scenegraph/textureinsgnode/main.cpp b/examples/quick/scenegraph/textureinsgnode/main.cpp
index 8eececc0aa..6358a1d75b 100644
--- a/examples/quick/scenegraph/textureinsgnode/main.cpp
+++ b/examples/quick/scenegraph/textureinsgnode/main.cpp
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- qmlRegisterType<FboInSGRenderer>("SceneGraphRendering", 1, 0, "Renderer");
+ qmlRegisterTypesAndRevisions<FboInSGRenderer>("SceneGraphRendering", 1);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/quick/scenegraph/textureinthread/main.cpp b/examples/quick/scenegraph/textureinthread/main.cpp
index 7a46f25390..7c22fa7fdf 100644
--- a/examples/quick/scenegraph/textureinthread/main.cpp
+++ b/examples/quick/scenegraph/textureinthread/main.cpp
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
return app.exec();
}
- qmlRegisterType<ThreadRenderer>("SceneGraphRendering", 1, 0, "Renderer");
+ qmlRegisterTypesAndRevisions<ThreadRenderer>("SceneGraphRendering", 1);
int execReturn = 0;
{
diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.h b/examples/quick/scenegraph/textureinthread/threadrenderer.h
index 8442041bf8..96c00e7b2e 100644
--- a/examples/quick/scenegraph/textureinthread/threadrenderer.h
+++ b/examples/quick/scenegraph/textureinthread/threadrenderer.h
@@ -58,6 +58,7 @@ class RenderThread;
class ThreadRenderer : public QQuickItem
{
Q_OBJECT
+ QML_NAMED_ELEMENT(Renderer)
public:
ThreadRenderer();
diff --git a/examples/quick/scenegraph/threadedanimation/main.cpp b/examples/quick/scenegraph/threadedanimation/main.cpp
index b1b0c05085..c77a291f5d 100644
--- a/examples/quick/scenegraph/threadedanimation/main.cpp
+++ b/examples/quick/scenegraph/threadedanimation/main.cpp
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- qmlRegisterType<Spinner>("Spinner", 1, 0, "Spinner");
+ qmlRegisterTypesAndRevisions<Spinner>("Spinner", 1);
QQuickView view;
view.setSource(QUrl("qrc:///scenegraph/threadedanimation/main.qml"));
diff --git a/examples/quick/scenegraph/threadedanimation/spinner.h b/examples/quick/scenegraph/threadedanimation/spinner.h
index c3f3394c93..fd3eaa7751 100644
--- a/examples/quick/scenegraph/threadedanimation/spinner.h
+++ b/examples/quick/scenegraph/threadedanimation/spinner.h
@@ -58,6 +58,7 @@ class Spinner : public QQuickItem
Q_OBJECT
Q_PROPERTY(bool spinning READ spinning WRITE setSpinning NOTIFY spinningChanged)
+ QML_ELEMENT
public:
Spinner();
diff --git a/examples/quick/scenegraph/twotextureproviders/main.cpp b/examples/quick/scenegraph/twotextureproviders/main.cpp
index a5d23b6adc..3f53bb6e32 100644
--- a/examples/quick/scenegraph/twotextureproviders/main.cpp
+++ b/examples/quick/scenegraph/twotextureproviders/main.cpp
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- qmlRegisterType<XorBlender>("SceneGraphRendering", 1, 0, "XorBlender");
+ qmlRegisterTypesAndRevisions<XorBlender>("SceneGraphRendering", 1);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/quick/scenegraph/twotextureproviders/xorblender.h b/examples/quick/scenegraph/twotextureproviders/xorblender.h
index 94132f09fb..17557b8efd 100644
--- a/examples/quick/scenegraph/twotextureproviders/xorblender.h
+++ b/examples/quick/scenegraph/twotextureproviders/xorblender.h
@@ -58,6 +58,7 @@ class XorBlender : public QQuickItem
Q_OBJECT
Q_PROPERTY(QQuickItem *source1 READ source1 WRITE setSource1 NOTIFY source1Changed)
Q_PROPERTY(QQuickItem *source2 READ source2 WRITE setSource2 NOTIFY source2Changed)
+ QML_ELEMENT
public:
explicit XorBlender(QQuickItem *parent = 0);