[Interest] Is this working for anyone, making a QML extension.

Koehne Kai Kai.Koehne at digia.com
Wed Dec 4 09:23:05 CET 2013

> -----Original Message-----
> From: interest-bounces+kai.koehne=digia.com at qt-project.org
> [mailto:interest-bounces+kai.koehne=digia.com at qt-project.org] On Behalf
> Of Alan Alpert
> Sent: Wednesday, December 04, 2013 1:20 AM
> To: Mark Gaiser
> Cc: Qt Interest
> Subject: Re: [Interest] Is this working for anyone, making a QML extension.
> My guess is that "importPaths" in the .qmlproject file never got hooked up
> for qmlscene. Try setting the import path and running the file manually, i.e.
> "qml -I /your/long/import/path yourQmlFile.qml".

Works for me. You can easily check whether the import path is passed to qml/qmlscene by setting the "QML_IMPORT_TRACE" environment variable to some value under Run Settings, Run Environment.

> > If i do that i get the "module is not installed" line every time.
> > But i DON'T get that line from modules that are installed by KDE or
> > ones that i made myself. The only difference there is CMake rather
> > then QMake.. I wonder if that could make a difference?
> >
> > Please let me hear what your results are. It's a ~5 minute testcase.

Getting QML import paths right is actually quite tricky due to the rule that the uri set in the qmldir and the local directory tree must match. This goes a bit against Qt Creator's philosophy to do shadow builds, and not adding an 'install' step by default...

If you used the default settings in the wizard and have the uri "com.mycompany.qmlcomponents" make sure that your qmldir file and .so file ends up in the directory "com/mycompany/qmlcomonents" underneath the path you set in via 'importPaths' ... The extension plugin created by Qt Creator actually doesn't do that automatically, but instead copies the files to Qt's 'qml' directory when running 'make install'. You can tweak the path it installs to in the .pro file.

With these changes, the setup you described works for me. Maybe we should indeed add a 'make install' step by default in the Qt Creator wizard ... Feel free to create a suggestion on bugreports.qt-project.org, so it's not forgotten (it's too late for 3.0 certainly).



More information about the Interest mailing list