Source: "qrc:/images/starfish_1.png" in qml sample code
-
Keep seeing
source: "qrc:/images/starfish_1.png" in qml sample code and i have to change it to below source:" /home/common/..."I tried to insert the image as in Resources/qml.qrc/bear.png but i can't call the file out in qml.
Why :>@
SpriteSequence{
sprites: Sprite {
name:bear
source:"/home/common/Desktop/bear.png"
frameCount:13
frameDuration: 120}
}
@
-
Hi,
Did you try prepending file:// to the path ?
I think you must search the file in Qt Installed directory on your system. -
Hi,
If your QML file is save in the same qrc file with images you can use path like:
@
path_to_image_from_current_qml_file/image.png
@For example, if you have path structure like this:
@
qml/
images/
image.png
mail.qml
@And you want to show file image.png you should use path in main.qml like:
@
Image {
id: icon
source: "images/image.png"
}
@or full path from resources like this:
@
Image {
id: icon
source: "qrc:///qml/images/image.png"
}
@But I recomend to you use the first way.