QML Image source not loading on to the screen
-
wrote on 25 Aug 2023, 07:48 last edited by amitsgh
I have my image in the
resources.qrc
file with the path:/images/assets/icons8-rocket-94.png
and urlqrc:/images/assets/icons8-rocket-94.png
I have tried the everything and still I can't get to load the image on to the screen.
I have tried the following -
source: "qrc:/images/assets/icons8-rocket-94.png" source: "qrc://images/assets/icons8-rocket-94.png" source: "qrc:///images/assets/icons8-rocket-94.png" source: "../assets/icons8-rocket-94.png" source: "C:/Users/username/Qt/learn_qt/qml_basics/qml_basic/assets"
-
Image.qml file -
Cmake file -
Main.qml file -
File Structure -
I have my image in the
resources.qrc
file with the path:/images/assets/icons8-rocket-94.png
and urlqrc:/images/assets/icons8-rocket-94.png
I have tried the everything and still I can't get to load the image on to the screen.
I have tried the following -
source: "qrc:/images/assets/icons8-rocket-94.png" source: "qrc://images/assets/icons8-rocket-94.png" source: "qrc:///images/assets/icons8-rocket-94.png" source: "../assets/icons8-rocket-94.png" source: "C:/Users/username/Qt/learn_qt/qml_basics/qml_basic/assets"
Window -
still I can't able the load the image. Pls help!!Image
also needs awidth
andheight
. -
-
@amitsgh No worries, it happens to everybody. And QML is notorious for not printing enough warnings so it's easy to miss such details.
1/4