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

Mark Gaiser markg85 at gmail.com
Wed Dec 4 14:43:38 CET 2013

On Wed, Dec 4, 2013 at 9:23 AM, Koehne Kai <Kai.Koehne at digia.com> wrote:
>> -----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).
> Regards
> Kai

What you describe is spot on!

What i was seeing is QtCreator to pick up my newly created QML plugin
yet qmlscene (and qml) didn't seem to think the same way when running.
Turns out that the paths where not right after all. Here is a detailed

I made a QML plugin through the QtCreator gui which installs it in a
path like so:
/some/long/path/build-<projectname>-Desktop-Debug/ .. files

I simply added that path to my importPaths. QtCreator likes it that
way and recognizes it!
However, i imported the plugin using a line like:

import MyAwesomeQMLPluginTest 1.0

However, in the added path there was no folder called /MyAwesomeQMLPluginTest/
_this_ is the issue. QtCreator recognizes it, qmlscene doesn't. That
leads you to think that something is wrong in the qmlscene since
QtCreator sees it just fine. I don't think you need to add a "make
install" step to QtCreator for those plugin. QtCreator obviously knows
how to parse this plugin while it's still not valid for qmlscene. It
should check on that and let me know that it can find the plugin but
that it's placed in the wrong location and provide hints about what it
should do.

Fixed for me. I'm obviously going to check for this error next time
qmlscene blames about a missing module ;)

More information about the Interest mailing list