As qml files in qrc import plugins
I have one PyQt4 project that uses qml files. Now I want to add some qml files to the qrr file:
In the qrc file:
<qresource prefix="/">
<file>dir1/dir2/file1.qml</file>
<file>dir1/dir2/file2.qml</file>
</qresource>
Use pyrcc4 tool to generate rc.py:
pyrcc4 -o source_rc.py source.qrc
Then, in a python script, I can call qml files like:
import source_rc
....
qml_path = "qrc:/dir1/dir2/file1.qml"
But now I have one problem because in my qml file I imported a QtDestop component like this (the QtDeskop path is in / dir 1 / dir2 / QtDesktop):
import "QtDesktop"
....
CursorArea{
.....
}
So when I start my application, it will crash and report this:
qrc:/dir1/dir2/file1.qml:2:1 "QtDesktop": no such directory
It can't seem to find the QtDesktop path. I am trying to add the complete QtDestkop folder to qrc, but it has one plugin library libstyleplugin.so that cannot be added to qrc.
Is there anyone who can help solve this problem? Many thanks!
+3
source to share
No one has answered this question yet
Check out similar questions: