QML absolute images path work on windows , while don't work on mac , why
-
in order to provide skin options for applications , I couldn't put the images in qrc files , while I put qml files in qrc files , because I want to hide these qml files to customers , I pass the absoulte path (get from QDir::currentPath()) and use QDeclarativeContext::setContextProperty("mainWidget",this) to pass the absolute path to qml , and in my qml files , I construct the images path like this ,source:mainWidget.absolutePath +"/images/top_bg.png" , and it works well on windows , in debug folder , I put the images folder which contains all the images in debug folder with exe in the same folder, and it can find the images and show the application UI well , while on mac , at first I try to make with bundle option , it can't work , then I make without bundle option(in pro file , with CONFIG -= app_bundle ) , and still it can't find the images , and it said errors :
qrc:/qml/BottomStatusLine.qml:8:5: QML Image: Cannot open: qrc:/Users/macmaya/images/statebar_bg.png
qrc:/qml/NDuoDemo.qml:20:9: QML BorderImage: Cannot open: qrc:/Users/macmaya/images/shadow.pngIt automatically take it as the qrc source files , because the qml files are in qrc , while it can work on windows , while it can't work on
mac , and if I want to make it as bundle option , how could I do to make it recognize the images . thanks guys . -
You need put the images to YourAppName.app/Contents/MacOS, have a look at how do deployment on Mac OS X on document.
-
Hi,
I'm working on MacOS X and I have the same problem. I want my QML file to be located in the appbundle, but my images can't be located in the bundle. Because it's the users who choose them at runtime like if I was writting a paint in QML.I'm using Qt5 and I'm running out of ideas :(. The only thing I need is to be able to show external image (out of the app bundle).
Thanks for reading me :).