[SOLVED]Image and relative pathes to the image



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



  • 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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.