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. Source: "qrc:/images/starfish_1.png" in qml sample code
Forum Updated to NodeBB v4.3 + New Features

Source: "qrc:/images/starfish_1.png" in qml sample code

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 1.1k 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.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

    Keep seeing
    source: "qrc:/images/starfish_1.png" in qml sample code and i have to change it to below source:" /home/common/..."

    I tried to insert the image as in Resources/qml.qrc/bear.png but i can't call the file out in qml.
    Why :>

    @

    SpriteSequence{
    sprites: Sprite {
    name:bear
    source:"/home/common/Desktop/bear.png"
    frameCount:13
    frameDuration: 120

                                              }
    

    }

    @

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      Did you try prepending file:// to the path ?
      I think you must search the file in Qt Installed directory on your system.

      157

      1 Reply Last reply
      0
      • shavS Offline
        shavS Offline
        shav
        wrote on last edited by
        #3

        Hi,

        If your QML file is save in the same qrc file with images you can use path like:
        @
        path_to_image_from_current_qml_file/image.png
        @

        For example, if you have path structure like this:
        @
        qml/
        images/
        image.png
        mail.qml
        @

        And you want to show file image.png you should use path in main.qml like:
        @
        Image {
        id: icon
        source: "images/image.png"
        }
        @

        or full path from resources like this:
        @
        Image {
        id: icon
        source: "qrc:///qml/images/image.png"
        }
        @

        But I recomend to you use the first way.

        Mac OS and iOS Developer

        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