QML files in resources
-
Hi!
I have the following problem: I created a qml extension plugin, which I install to a certain place on my system (i.e. I put there a libXXX.so, a qmldir, and a plugins.qmltypes file). The plugin holds some components written in C++, and some pure qml components. Since I do not want my qml files to be public, I added them to my resources (using a .qrc file) and compiled them into the plugin. In addition, I added lines like
@AnimatedMessageBox 1.0 qrc:///qml/AnimatedMessageBox.qml@
to my qmldir-file to make the qml stuff available.
In a test QtQuick-application (running in QtCreator) I can import and use all components from the plugin without problems (after setting the importPaths property correctly). Nevertheless, the pure qml components of the plugin are always marked in red ("unknown component") in QtCreator and their properties are not available. For big components, this is really annoying. The C++ components are displayed properly.
Any idea how to solve this?
Thanks a lot!
P.S.: I tried to put the pure qml components into the plugins.qmltypes file, too, but this seems to make no difference. (Holding the mouse pointer over the import statement for the plugin, I get a message "Read typeinfo files successfully" by the way.)
P.P.S: I use QtCreator 3.1.0, Qt 5.2.1 on a 64bit Ubuntu 14.04
-
The code model cannot access the .qml file in the resources.
The solution is to do the same as Qt does for QtQuick.Controls.
You have to register the .qml files as composite types using qmlRegisterType() and then use qmlplugindump to create a proper plugins.qmltypes file.