diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-09-14 14:09:14 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-09-14 22:07:43 +0000 |
commit | e18b178d9a3bff54c92d80f1a0923ab72bf27267 (patch) | |
tree | db53c8f6fe62d3873ef37442cdc735370df2a744 /src/imports/extras | |
parent | 8a10e85db212d88887ad7f14ad7e4048a87a8c2d (diff) |
Register types in C++ (instead of qmldir)
Later on, we can choose to register types from different style-subdirs
based on a yet unknown style selector (app manifest file, env var, ...)
This is also a step to the right direction to get QML types inherit
enums and attached properties from the respective C++ base types. The
qmlRegisterType(QUrl) overload for composite types probably needs a
template argument to help figure out the missing meta-object link
between the composite type and the C++ base type.
Change-Id: I9b3c2afdd93fff56d1e7513879b3e9229f483cbf
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/imports/extras')
-rw-r--r-- | src/imports/extras/qmldir | 4 | ||||
-rw-r--r-- | src/imports/extras/qtquickextras2plugin.cpp | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/imports/extras/qmldir b/src/imports/extras/qmldir index 51c99e31..8822d83b 100644 --- a/src/imports/extras/qmldir +++ b/src/imports/extras/qmldir @@ -1,7 +1,3 @@ module QtQuick.Extras plugin qtquickextras2plugin classname QtQuickExtras2Plugin -Dial 2.0 Dial.qml -Drawer 2.0 Drawer.qml -SwipeView 2.0 SwipeView.qml -Tumbler 2.0 Tumbler.qml diff --git a/src/imports/extras/qtquickextras2plugin.cpp b/src/imports/extras/qtquickextras2plugin.cpp index 8b1ebb50..f1307558 100644 --- a/src/imports/extras/qtquickextras2plugin.cpp +++ b/src/imports/extras/qtquickextras2plugin.cpp @@ -35,6 +35,7 @@ ****************************************************************************/ #include <QtQml/qqmlextensionplugin.h> +#include <QtCore/qdir.h> #include "qquickdial_p.h" #include "qquickdrawer_p.h" @@ -59,6 +60,12 @@ void QtQuickExtras2Plugin::registerTypes(const char *uri) qmlRegisterType<QQuickSwipeView>(uri, 2, 0, "AbstractSwipeView"); qmlRegisterType<QQuickTumbler>(uri, 2, 0, "AbstractTumbler"); qmlRegisterType<QQuickTumblerAttached>(); + + QDir baseDir(baseUrl().toLocalFile()); + qmlRegisterType(QUrl::fromLocalFile(baseDir.filePath(QStringLiteral("Dial.qml"))), uri, 2, 0, "Dial"); + qmlRegisterType(QUrl::fromLocalFile(baseDir.filePath(QStringLiteral("Drawer.qml"))), uri, 2, 0, "Drawer"); + qmlRegisterType(QUrl::fromLocalFile(baseDir.filePath(QStringLiteral("SwipeView.qml"))), uri, 2, 0, "SwipeView"); + qmlRegisterType(QUrl::fromLocalFile(baseDir.filePath(QStringLiteral("Tumbler.qml"))), uri, 2, 0, "Tumbler"); } QT_END_NAMESPACE |