How to set the the path of images in qml file if the qml file is in resource ?
-
[EDIT: moved this post here from another thread, Volker]
sorry , I am afraid you guys misunderstand this question , if qml files is not embeded in the qrc files ,
there is no problem referring the qml files and images file with relative or absolute path , but if we embeded the qml files into the qrc files , while the images files is not embeded in the qrc files , like
qml refering using "qrc:/qml/myqml.qml" , images using "images/hello.png", and images folder is under exe folder , it can't find the image files .why I want to do it in this way , because I want to hide the qml files when I release my software , while I exposed the images files , because I want to provide skin options , customers can download new images from our website and replace the old image files , how can I solve this problem ? -
but if we embeded the qml files into the qrc files , while the images files is not embeded in the qrc files , like
qml refering using “qrc:/qml/myqml.qml” , images using “images/hello.png”, and images folder is under exe folder , it can’t find the image files .why I want to do it in this way , because I want to hide the qml files when I release my software , while I exposed the images files , because I want to provide skin options , customers can download new images from our website and replace the old image files , how can I solve this problem ? -
You always can pass absolute path of your app folder (which you can retrieve in run-time) as context property to qml and concat it with your image path
-
Volker, OP asks about using non-resourced images in resourced qml. I'm not sure it is possible with relative paths.
-
Also you can build this and use imagePath hack in Qt Creator and QmlViewer - https://github.com/misterion/QmlViewerDevHelper
-
Please read the following "thread":http://developer.qt.nokia.com/forums/viewthread/5617 because I believe it discuss the same issue.
@leon.anavi the link is no longer valid!