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.png

    It 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 .

  • Closed. Duplicate of http://developer.qt.nokia.com/forums/viewthread/7403/

    You are note likely to get any help if you keep reposting your unanswered questions. Especially if reposted within a day.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.