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. [SOLVED]Image and relative pathes to the image
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Image and relative pathes to the image

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

    Hi folks, I have a project tree which is similar to the following:
    @root
    group
    Window.qml
    images
    set.png
    unset.png
    Button.qml@

    Button.qml has 2 properties setImage/unsetImage which are used by the inner Image element regarding to the button state. Then I create buttons in Window.qml and pass two images as follows:
    @Button{
    setImage: "images/set.png"
    unsetImage: "images/unset.png"
    }@

    It gives me the error about paths because it tries to locate those images relative to the Button.qml not the Window.qml
    The question is: is it supposed behavior? and can I change this behavior somehow?
    P.S. there is no such problems with aliased properties.

    1 Reply Last reply
    0
    • X Offline
      X Offline
      X-Krys
      wrote on last edited by
      #2

      I think your setImage/unsetImage property type is string.
      Just use the url type in order to resolve the path.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        ixSci
        wrote on last edited by
        #3

        wow, X-Krys, thanks!

        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