[Development] Help with Plugin

Steve Gold steveg2357 at gmail.com
Thu Jun 5 23:17:43 CEST 2014


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 contents? 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.

Thanks.

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140605/e7b89059/attachment.html>


More information about the Development mailing list