aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick
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
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')
-rw-r--r--examples/quick/customitems/maskedmousearea/main.cpp2
-rw-r--r--examples/quick/customitems/maskedmousearea/maskedmousearea.h1
-rw-r--r--examples/quick/customitems/painteditem/TextBalloonPlugin/plugin.h2
-rw-r--r--examples/quick/customitems/painteditem/textballoon.h1
-rw-r--r--examples/quick/quickwidgets/qquickviewcomparison/fbitem.h1
-rw-r--r--examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp2
-rw-r--r--examples/quick/quickwidgets/quickwidget/fbitem.h1
-rw-r--r--examples/quick/quickwidgets/quickwidget/main.cpp2
-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
-rw-r--r--examples/quick/tableview/gameoflife/gameoflifemodel.h2
-rw-r--r--examples/quick/tableview/gameoflife/main.cpp2
-rw-r--r--examples/quick/tableview/pixelator/imagemodel.h2
-rw-r--r--examples/quick/tableview/pixelator/main.cpp2
33 files changed, 36 insertions, 17 deletions
diff --git a/examples/quick/customitems/maskedmousearea/main.cpp b/examples/quick/customitems/maskedmousearea/main.cpp
index 63558d1b20..626f0fd765 100644
--- a/examples/quick/customitems/maskedmousearea/main.cpp
+++ b/examples/quick/customitems/maskedmousearea/main.cpp
@@ -59,7 +59,7 @@ int main(int argc, char* argv[])
QGuiApplication app(argc,argv);
QQuickView view;
- qmlRegisterType<MaskedMouseArea>("Example", 1, 0, "MaskedMouseArea");
+ qmlRegisterTypesAndRevisions<MaskedMouseArea>("Example", 1);
view.setSource(QUrl("qrc:///customitems/maskedmousearea/maskedmousearea.qml"));
view.show();
diff --git a/examples/quick/customitems/maskedmousearea/maskedmousearea.h b/examples/quick/customitems/maskedmousearea/maskedmousearea.h
index 28ff6ca9df..39d78a019a 100644
--- a/examples/quick/customitems/maskedmousearea/maskedmousearea.h
+++ b/examples/quick/customitems/maskedmousearea/maskedmousearea.h
@@ -62,6 +62,7 @@ class MaskedMouseArea : public QQuickItem
Q_PROPERTY(bool containsMouse READ containsMouse NOTIFY containsMouseChanged)
Q_PROPERTY(QUrl maskSource READ maskSource WRITE setMaskSource NOTIFY maskSourceChanged)
Q_PROPERTY(qreal alphaThreshold READ alphaThreshold WRITE setAlphaThreshold NOTIFY alphaThresholdChanged)
+ QML_ELEMENT
public:
MaskedMouseArea(QQuickItem *parent = 0);
diff --git a/examples/quick/customitems/painteditem/TextBalloonPlugin/plugin.h b/examples/quick/customitems/painteditem/TextBalloonPlugin/plugin.h
index d3a1f4ba91..41750d1647 100644
--- a/examples/quick/customitems/painteditem/TextBalloonPlugin/plugin.h
+++ b/examples/quick/customitems/painteditem/TextBalloonPlugin/plugin.h
@@ -59,6 +59,6 @@ class TextBalloonPlugin : public QQmlExtensionPlugin
public:
void registerTypes(const char *uri)
{
- qmlRegisterType<TextBalloon>(uri, 1, 0, "TextBalloon");
+ qmlRegisterTypesAndRevisions<TextBalloon>(uri, 1);
}
};
diff --git a/examples/quick/customitems/painteditem/textballoon.h b/examples/quick/customitems/painteditem/textballoon.h
index 81b3e2961d..eb72804602 100644
--- a/examples/quick/customitems/painteditem/textballoon.h
+++ b/examples/quick/customitems/painteditem/textballoon.h
@@ -58,6 +58,7 @@ class TextBalloon : public QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY(bool rightAligned READ isRightAligned WRITE setRightAligned NOTIFY rightAlignedChanged)
+ QML_ELEMENT
public:
TextBalloon(QQuickItem *parent = 0);
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.h b/examples/quick/quickwidgets/qquickviewcomparison/fbitem.h
index 3a4c5a13c2..6270e7adff 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.h
+++ b/examples/quick/quickwidgets/qquickviewcomparison/fbitem.h
@@ -111,6 +111,7 @@ class FbItem : public QQuickFramebufferObject
Q_PROPERTY(QVector3D target READ target WRITE setTarget)
Q_PROPERTY(QVector3D rotation READ rotation WRITE setRotation)
Q_PROPERTY(bool multisample READ multisample WRITE setMultisample)
+ QML_ELEMENT
public:
explicit FbItem(QQuickItem *parent = 0);
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp b/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp
index 84e116dce6..6ebf36c454 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp
+++ b/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp
@@ -86,7 +86,7 @@ MainWindow::MainWindow(bool transparency, bool noRenderAlpha)
m_labelStatus = new QLabel;
layout->addWidget(m_labelStatus);
- qmlRegisterType<FbItem>("fbitem", 1, 0, "FbItem");
+ qmlRegisterTypesAndRevisions<FbItem>("fbitem", 1);
QWidget *quickContainer = new QWidget;
layout->addWidget(quickContainer);
diff --git a/examples/quick/quickwidgets/quickwidget/fbitem.h b/examples/quick/quickwidgets/quickwidget/fbitem.h
index 7beb9874a5..c1fb866c9a 100644
--- a/examples/quick/quickwidgets/quickwidget/fbitem.h
+++ b/examples/quick/quickwidgets/quickwidget/fbitem.h
@@ -56,6 +56,7 @@
class FbItem : public QQuickFramebufferObject
{
Q_OBJECT
+ QML_ELEMENT
public:
Renderer *createRenderer() const;
};
diff --git a/examples/quick/quickwidgets/quickwidget/main.cpp b/examples/quick/quickwidgets/quickwidget/main.cpp
index c54586c5de..541f543f07 100644
--- a/examples/quick/quickwidgets/quickwidget/main.cpp
+++ b/examples/quick/quickwidgets/quickwidget/main.cpp
@@ -214,7 +214,7 @@ int main(int argc, char **argv)
optMultipleSample = parser.isSet(multipleSampleOption);
optCoreProfile = parser.isSet(coreProfileOption);
- qmlRegisterType<FbItem>("QuickWidgetExample", 1, 0, "FbItem");
+ qmlRegisterTypesAndRevisions<FbItem>("QuickWidgetExample", 1);
MainWindow mainWindow;
mainWindow.show();
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);
diff --git a/examples/quick/tableview/gameoflife/gameoflifemodel.h b/examples/quick/tableview/gameoflife/gameoflifemodel.h
index 3ea1469861..161e0b2cfc 100644
--- a/examples/quick/tableview/gameoflife/gameoflifemodel.h
+++ b/examples/quick/tableview/gameoflife/gameoflifemodel.h
@@ -54,11 +54,13 @@
#include <array>
#include <QAbstractTableModel>
#include <QPoint>
+#include <QtQml/qqml.h>
//! [modelclass]
class GameOfLifeModel : public QAbstractTableModel
{
Q_OBJECT
+ QML_ELEMENT
Q_ENUMS(Roles)
public:
diff --git a/examples/quick/tableview/gameoflife/main.cpp b/examples/quick/tableview/gameoflife/main.cpp
index 5101880b06..fcea7080ea 100644
--- a/examples/quick/tableview/gameoflife/main.cpp
+++ b/examples/quick/tableview/gameoflife/main.cpp
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
//! [registertype]
- qmlRegisterType<GameOfLifeModel>("GameOfLifeModel", 1, 0, "GameOfLifeModel");
+ qmlRegisterTypesAndRevisions<GameOfLifeModel>("GameOfLifeModel", 1);
//! [registertype]
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
diff --git a/examples/quick/tableview/pixelator/imagemodel.h b/examples/quick/tableview/pixelator/imagemodel.h
index bf0ec90da4..de8ad7cd8d 100644
--- a/examples/quick/tableview/pixelator/imagemodel.h
+++ b/examples/quick/tableview/pixelator/imagemodel.h
@@ -53,12 +53,14 @@
#include <QAbstractTableModel>
#include <QImage>
+#include <QtQml/qqml.h>
//! [model]
class ImageModel : public QAbstractTableModel
{
Q_OBJECT
Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged)
+ QML_ELEMENT
public:
ImageModel(QObject *parent = nullptr);
diff --git a/examples/quick/tableview/pixelator/main.cpp b/examples/quick/tableview/pixelator/main.cpp
index c57039556a..a8cb6c4e86 100644
--- a/examples/quick/tableview/pixelator/main.cpp
+++ b/examples/quick/tableview/pixelator/main.cpp
@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
//! [registertype]
- qmlRegisterType<ImageModel>("ImageModel", 1, 0, "ImageModel");
+ qmlRegisterTypesAndRevisions<ImageModel>("ImageModel", 1);
//! [registertype]
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));