Important: Please read the Qt Code of Conduct -

how to use image in qt qml

  • hi
    i have a images folder in the root folder of program
    when i use this code for use image in program

    Image {
    id: bug
    source: "images/bug.jpg"

    i have this error
    QML Image: Cannot open: qrc:/name of pic.jpg

    please guide me

  • Hi and welcome to the devnet,

    try using the full path with leading file://
    source: "file:///home/username/project/images/bug.jpg


  • Hi,

    this error usually means "The resource (qrc:/name of pic.jpg) is not specified in a .qrc file."
    Probably, you need to look at Qt Resource System article.
    Most likely it will help you.