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 display image from a folder in qml

how to display image from a folder in qml

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 1.7k Views
  • 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.
  • V Offline
    V Offline
    vamsi1992
    wrote on last edited by
    #1

    i'm trying to display an image which is present in local folder but i'm unable to do that to display an image in qml we need to add it to resource files but here I should read a image from a local folder can someone help me on this

    J.HilkJ 1 Reply Last reply
    0
    • V vamsi1992

      i'm trying to display an image which is present in local folder but i'm unable to do that to display an image in qml we need to add it to resource files but here I should read a image from a local folder can someone help me on this

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @vamsi1992 what did you do so far ?

      usually you would do it like this

      Image {
          source: "file:///c:/path/to/my/resources/images/image.png"
      }
      

      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      2
      • V Offline
        V Offline
        vamsi1992
        wrote on last edited by
        #3

        Image{
        id:albumimg
        anchors.fill:albumart
        source:"//home/user/Desktop/album.png"

        V J.HilkJ 2 Replies Last reply
        0
        • V vamsi1992

          Image{
          id:albumimg
          anchors.fill:albumart
          source:"//home/user/Desktop/album.png"

          V Offline
          V Offline
          vamsi1992
          wrote on last edited by
          #4

          Thank you @J-Hilk it worked

          1 Reply Last reply
          1
          • V vamsi1992

            Image{
            id:albumimg
            anchors.fill:albumart
            source:"//home/user/Desktop/album.png"

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @vamsi1992
            yes, add the file:/// tag, its an actual URL when when you want to refer to a local file


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            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