Problem with QML plugins
-
I am trying to create a plugin consisting of QML types but no C++ classes. I built a simple QML file called MyPlugin.qml that starts with “pragma Singleton” and resides in <mypath>\MyPlugin. My qmldir file consists of
@
module MyPlugin
singleton MyPlugin 1.0 MyPlugin.qml
@When I run
@
<qtpath>\5.3\mingw482_32\bin\qmlplugindump -nonrelocatable MyPlugin 1.0 .
@from <mypath> a plugins.qmltypes file is created with
@
Module {
Component {
prototype: "QQuickItem"
name: "MyPlugin"
exports: ["MyPlugin -1.-1"]
exportMetaObjectRevisions: [-1]
isComposite: true
isCreatable: false
isSingleton: true
. . .
@and all of the methods (corresponding to my functions) and their parameters have type QVariant.
Is my qmldir correct to generate the plugins.qmltypes file? Why do exports and exportMetaObjectRevisions have such strange content? Should these be changed to “MyPlugin 1.0” and 0, respectively? Should the QVariant types be manually changed?
Are there any examples of creating and using Qt plugins made entirely with just QML and no C++? It would be useful to see an example that creates (1) library files, (2) plugins.qmltypes, and (3) an app using the output of 1 and 2.