From cc1a604c704f848927b3fa0a97b0a50b0b79d2a4 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 21 Aug 2019 18:34:21 +0200 Subject: 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 Reviewed-by: Simon Hausmann --- examples/quick/customitems/maskedmousearea/main.cpp | 2 +- examples/quick/customitems/maskedmousearea/maskedmousearea.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/quick/customitems/maskedmousearea') 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("Example", 1, 0, "MaskedMouseArea"); + qmlRegisterTypesAndRevisions("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); -- cgit v1.2.3