Important: Please read the Qt Code of Conduct -

[SOLVED]Image and relative pathes to the image

  • Hi folks, I have a project tree which is similar to the following:

    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:
    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.

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

  • wow, X-Krys, thanks!

Log in to reply