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
QtWS25 Last Chance

how to display image from a folder in qml

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 1.6k 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 17 Dec 2019, 06:10 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 1 Reply Last reply 17 Dec 2019, 06:12
    0
    • V vamsi1992
      17 Dec 2019, 06:10

      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 Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 17 Dec 2019, 06:12 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 17 Dec 2019, 06:16 last edited by
        #3

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

        V J 2 Replies Last reply 17 Dec 2019, 06:19
        0
        • V vamsi1992
          17 Dec 2019, 06:16

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

          V Offline
          V Offline
          vamsi1992
          wrote on 17 Dec 2019, 06:19 last edited by
          #4

          Thank you @J-Hilk it worked

          1 Reply Last reply
          1
          • V vamsi1992
            17 Dec 2019, 06:16

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

            J Offline
            J Offline
            J.Hilk
            Moderators
            wrote on 17 Dec 2019, 06:19 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

            5/5

            17 Dec 2019, 06:19

            • Login

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