From 2c3419e127e55810da1741725b4ff39f118cd577 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 12 Sep 2019 17:03:52 +0200 Subject: 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 --- examples/quick/customitems/maskedmousearea/main.cpp | 3 --- .../customitems/maskedmousearea/maskedmousearea.pro | 4 ++++ .../customitems/painteditem/TextBalloonPlugin/plugin.h | 9 ++------- examples/quick/customitems/painteditem/painteditem.pro | 16 ++++++++++------ 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'examples/quick/customitems') diff --git a/examples/quick/customitems/maskedmousearea/main.cpp b/examples/quick/customitems/maskedmousearea/main.cpp index 626f0fd765..5b42516154 100644 --- a/examples/quick/customitems/maskedmousearea/main.cpp +++ b/examples/quick/customitems/maskedmousearea/main.cpp @@ -53,14 +53,11 @@ #include "maskedmousearea.h" - int main(int argc, char* argv[]) { QGuiApplication app(argc,argv); QQuickView view; - qmlRegisterTypesAndRevisions("Example", 1); - view.setSource(QUrl("qrc:///customitems/maskedmousearea/maskedmousearea.qml")); view.show(); return app.exec(); diff --git a/examples/quick/customitems/maskedmousearea/maskedmousearea.pro b/examples/quick/customitems/maskedmousearea/maskedmousearea.pro index fe5c05ce61..c5cedf4e6e 100644 --- a/examples/quick/customitems/maskedmousearea/maskedmousearea.pro +++ b/examples/quick/customitems/maskedmousearea/maskedmousearea.pro @@ -2,6 +2,10 @@ TEMPLATE = app QT += quick qml +CONFIG += qmltypes +QML_IMPORT_NAME = Example +QML_IMPORT_MAJOR_VERSION = 1 + HEADERS += maskedmousearea.h SOURCES += main.cpp \ diff --git a/examples/quick/customitems/painteditem/TextBalloonPlugin/plugin.h b/examples/quick/customitems/painteditem/TextBalloonPlugin/plugin.h index 41750d1647..972859f80e 100644 --- a/examples/quick/customitems/painteditem/TextBalloonPlugin/plugin.h +++ b/examples/quick/customitems/painteditem/TextBalloonPlugin/plugin.h @@ -52,13 +52,8 @@ #include "../textballoon.h" -class TextBalloonPlugin : public QQmlExtensionPlugin +class TextBalloonPlugin : public QQmlEngineExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) -public: - void registerTypes(const char *uri) - { - qmlRegisterTypesAndRevisions(uri, 1); - } + Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) }; diff --git a/examples/quick/customitems/painteditem/painteditem.pro b/examples/quick/customitems/painteditem/painteditem.pro index bc7480ab9e..641833f3aa 100644 --- a/examples/quick/customitems/painteditem/painteditem.pro +++ b/examples/quick/customitems/painteditem/painteditem.pro @@ -1,21 +1,25 @@ TEMPLATE = lib -CONFIG += plugin +CONFIG += plugin qmltypes QT += qml quick +QML_IMPORT_NAME = TextBalloonPlugin +QML_IMPORT_MAJOR_VERSION = 1 + TARGET = qmltextballoonplugin -HEADERS += TextBalloonPlugin/plugin.h \ +HEADERS += \ + TextBalloonPlugin/plugin.h \ textballoon.h SOURCES += textballoon.cpp RESOURCES += painteditem.qrc -DESTDIR = TextBalloonPlugin +DESTDIR = $$QML_IMPORT_NAME -target.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/TextBalloonPlugin -qmldir.files = TextBalloonPlugin/qmldir -qmldir.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/TextBalloonPlugin +target.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/$$QML_IMPORT_NAME +qmldir.files = $$QML_IMPORT_NAME/qmldir +qmldir.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/$$QML_IMPORT_NAME INSTALLS += qmldir target -- cgit v1.2.3