Ubuntu: How do I add a qrc file to my Ubuntu Touch qml project?


My UT QML project makes use of a set of images, and I was planning use them via "qrc:///pathtoimages/myimage.png" style of url.

In Ubuntu SDK, I can "add new... Qt / Qt Resource File".
The file is created, but then I get the following error saying:

enter image description here

  • What does the error mean?
  • Can I safely ignore it?
  • Will the package generation include my images?

[EDIT] After further investigation, it seems that using qt resources files only makes sense when using qmake, to embed some file into the binary. So it might be just useless in Ubuntu SDK.


You can manage resource files with the Qt resource system, but it's only meant to be use for applications mixing QML AND C++, not for projects started as simple Touch UI:

The Qt resource system allows resource files to be stored as binary files in an application executable. This can be useful when building a mixed QML/C++ application as it enables QML files (as well as other resources such as images and sound files) to be referred to through the resource system URI scheme rather than relative or absolute paths to filesystem resources.

For projects only made of QML files, the way to use images resource is by using relative paths in your QML application, e.g:

Image {      anchors.fill: parent      source: "../../svg/test.svg"  }  

All images files will be included automatically by the <My_project>.qmlproject file.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »