using resources system with qml
Unsolved
QML and Qt Quick
-
I'm developing an app and in need of using images for the user interface, I have them all in the resources.qrc and they look like this:
<RCC> <qresource prefix="/imgs"> <file>assets/background.svg</file> <file>assets/background_1.svg</file> <file>assets/LOGO.png</file> <file>assets/Logo.svg</file> </qresource> </RCC>
How do I use them?
I tried both:
//First trial: Image{ source: "qrc:///imgs/assets/LOGO.png" } //Second Trial Image{ source: "qrc:/imgs/assets/LOGO.png" }
but nothing worked, am I missing something?
Thanx
-
mine is more like this :
<RCC> <qresource prefix="/"> <file>imgs/assets/background.svg</file> <file>imgs/assets/background_1.svg</file> <file>imgs/assets/LOGO.png</file> <file>imgs/assets/Logo.svg</file> </qresource> </RCC> maybe try that and your files should be at the roots of the project not inside release or debug
-
Define resource import in your main QML file:
import "qrc:/res"
And then specify the same path as a source:
source: "/res/image.png"
My res file:
<RCC> <qresource prefix="/"> <file>res/image.png</file> </qresource> </RCC>
In my case, the image is located inside res folder in / prefix.