[SailfishDevel] Path to main qml in resource file - not found whatever I try

Bartek Taczała bartek.taczala at gmail.com
Wed Apr 23 07:35:02 UTC 2014


On Wednesday 23 of April 2014 09:23:29 tw_bolek wrote:
> Hi guys,
> 
> I've put all my qml files into a resource file and I did NOT include the qml folder in the rpm.
> 
> PROBLEM: what path should I use in the main.cpp file to point to the main qml file in the resource?
> 
> SailfishApp::pathTo("qml/main.qml") returns /usr/share/myapp/qml/main.qml  - not found
> 
> SailfishApp::pathTo("qrc:/qml/main.qml") returns /usr/share/myapp/qrc/qml/main.qml  - not found
> 
> SailfishApp::pathTo("qrc:///qml/main.qml") returns /usr/share/myapp/qrc:/qml/main.qml  - not found
> 
> and so on.
> 
> 
> So it stubbornly tries to locate it in the (missing) qml folder, not in the resource.
> 
> I'm out of ideas.
> 
> RESOURCES += \
>     myapp.qrc
> 
> is included in the .pro file  and all files are in it.
> 
> 
> Am I missing something else?
> 
> Please help!
> 
> Bolek
> 
> _______________________________________________
> SailfishOS.org Devel mailing list

I don't think you should use SailfishApp::pathTo since it points to a file in data directory (see sailfishapp.h for some documentation). 
Can you get on with using QUrl("qrc:/main.qml") ? 

B



More information about the Devel mailing list