I'm working on a project, where I have QML files in several directories.
This isn't a problem at runtime, because they're all copied to the same
qml dir.
But in QtC, I get the red error line under the components from other
dirs, and no completion.
I seem to remember that there is a way I can add dirs to the QML parser
to complete from, but I can't find it anymore. Anyone here have a good idea?
The setup is that I have a library that's shared between different
projects, and some of the files in this library are QML files, some are
C++. The C++ code isn't a problem, of course, but the QML files are
annoying.
Using svn externals directly on the file would put them in the same qml
dir as the files specific to the other projects, but that's a
maintenance nightmare.
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
_______________________________________________
Qt-qml mailing list
Qt-...@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml
http://doc.qt.nokia.com/qtcreator-2.4/creator-qml-modules-with-plugins.html
/Harri
On 03/08/2012 11:04 PM, Bo Thorsen wrote:
> Hi people,
>
> I'm working on a project, where I have QML files in several directories.
> This isn't a problem at runtime, because they're all copied to the same
> qml dir.
>
> But in QtC, I get the red error line under the components from other
> dirs, and no completion.
>
> I seem to remember that there is a way I can add dirs to the QML parser
> to complete from, but I can't find it anymore. Anyone here have a good idea?
>
> The setup is that I have a library that's shared between different
> projects, and some of the files in this library are QML files, some are
> C++. The C++ code isn't a problem, of course, but the QML files are
> annoying.
>
> Using svn externals directly on the file would put them in the same qml
> dir as the files specific to the other projects, but that's a
> maintenance nightmare.
>
> Bo Thorsen,
> Fionia Software.
>
_______________________________________________
Cheers,
Christian
________________________________________
From: qt-qml-bounces+christian.d.kamm=noki...@qt.nokia.com [qt-qml-bounces+christian.d.kamm=noki...@qt.nokia.com] on behalf of ext Bo Thorsen [b...@fioniasoftware.dk]
Sent: Thursday, March 08, 2012 11:04 PM
To: qt-...@qt.nokia.com
Subject: [Qt-qml] Adding QML components dirs
QML_IMPORT_PATH was exactly the variable I was looking for, thanks. But
unfortunately it doesn't work :(
I have a directory structure that looks like this:
project/
qml/
Most QML files here
mylib/
qml/
More QML files
The mylib.pri installs the qml files to the same qml directory as the
main qml files, so at runtime this is fine.
I have added "QML_IMPORT_PATH = mylib/qml" to the pro file. This doesn't
make any difference to the QtC code model. I have tried stuff like
adding $$PWD and other attempts. No difference. The components are not
recognised.
In the meantime, I have worked around it by adding a line saying
'import "../mylib/qml"' and installing the library components to a
separate directory that has the same path in the runtime dir as in the
source dir. It does work, but it means I restrict the way the source
tree is set up, and I really don't like that.
If anyone know why QML_IMPORT_PATH doesn't work for me, please tell.
Otherwise, I'll enter a bug report.
Cheers,
Bo.
On 12.03.2012 07:53, Bo Thorsen wrote:
> QML_IMPORT_PATH was exactly the variable I was looking for, thanks. But
> unfortunately it doesn't work :(
>
> I have a directory structure that looks like this:
>
> project/
> qml/
> Most QML files here
> mylib/
> qml/
> More QML files
>
> The mylib.pri installs the qml files to the same qml directory as the
> main qml files, so at runtime this is fine.
>
> I have added "QML_IMPORT_PATH = mylib/qml" to the pro file. This doesn't
> make any difference to the QtC code model. I have tried stuff like
> adding $$PWD and other attempts. No difference. The components are not
> recognised.
What is the name of your mylib module? If I understand it correctly it
is like that: if your module name is "dk.fioniasoftware.mylib" it would
look for mylib/qml/dk/fionasoftware/mylib/. So I would suggest to create
a directory-structure somewhere like somewhere/dk/fionasoftware/mylib,
where mylib is a symbolic link to mylib/qml. Then you set
QML_IMPORT_PATH = somwhere/dk/fionasoftware/mylib
and it should find the QML stuff in mylib/qml if you import
dk.fioniasoftware.mylib. But I didn't try it, just a guess.
Good luck,
Sven
...
> The mylib.pri installs the qml files to the same qml directory as the
> main qml files, so at runtime this is fine.
Ah, I'm sorry, that's not something QML_IMPORT_PATH can help with. It just adds to the QML module search path so qmldir files below the listed directories will be found. E.g. if you have
foo/my/module/qmldir
and set it to foo/ you could "import my.module". It won't help in your situation. The best solution is using an import like you did in your workaround.
Cheers,
Christian,
Ok, thanks for confirming this. I wasn't able to find the answer for
sure in the documentation, although I did suspect it to be the case.
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk