[SailfishDevel] Howto ship QML plugins for harbour

Aaron McCarthy aaron.mccarthy at jolla.com
Fri Jan 10 01:43:11 UTC 2014

On Thu, 9 Jan 2014 11:39:12 dcaliste at free.fr wrote:
> I need to ship two system QML plugins with my app for it to validate the
> harbour recommendations. How can I do this ?
> Let's take the example of QtPositioning
> We have:
> [nemo at SailfishEmul devel]$ rpm -ql qt5-qtdeclarative-import-positioning
> /usr/lib/qt5/qml/QtPositioning
> /usr/lib/qt5/qml/QtPositioning/libdeclarative_positioning.so
> /usr/lib/qt5/qml/QtPositioning/plugins.qmltypes
> /usr/lib/qt5/qml/QtPositioning/qmldir
> So, in the spec file, I can install these three files in
> /usr/share/$APPNAME/qml. But in the FAQ of the harbour, they say that one
> should rename the import to harbour.appname.QtPositioning, when I grep
> QtPositioning in qmldir and plugins.qmltypes, it appears a lot of times.
> Should I replace all with APPNAME-QtPositioning ? Then, should the
> directory be renamed also ?

Disclaimer: I haven't tried this.

You will have to patch and rebuild the QML plugin. This is because it is 
verifying that the correct import uri is used. You will need to patch the 
source to accept the harbour.appname.QtPositioning uri.

It is also not just a mater of shipping the QML plugin with your application, 
you will need to ship all dependencies not approved by Harbour. For Qt 
Positioning this would also mean the Qt Positioning C++ library as well.

The plugins.qmltypes file is not important at run-time. It is used by Qt 
Creator for syntax highlighting and code completion.

> And finally, when all is shipped in the RPM, and everything has been renamed
> properly, how can I expand the QML search dir to include also
> /usr/share/$APPNAME/qml ?

QQmlEngine::addImportPath() or set QML2_IMPORT_PATH

> Thanks for the help, have a nice day,


Aaron McCarthy

More information about the Devel mailing list