Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. how to use image in qt qml

how to use image in qt qml

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmlqt5.5image display
3 Posts 3 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    neda
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • C Offline
      C Offline
      clochydd
      wrote on last edited by clochydd
      #2

      Hi and welcome to the devnet,

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

      edit:
      or:
      qrc:///images/bug.jpg

      1 Reply Last reply
      0
      • speqtrS Offline
        speqtrS Offline
        speqtr
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved