Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qml image source not taking special character like #



  • Hi,
    I am facing some problem with QML image tag. this is not taking # in path. Can some one tell me the way to do this. Or any way to path decoding in CPP file.
    @Image {
    id: bgImage
    width: rectMain.width
    height: rectMain.height
    fillMode: Image.Stretch
    smooth: true
    z: 0
    opacity: 0.940
    source: "C:/Users/Main/Music/music/Agneepath#/Agneepath.png"
    }@
    Thanks in advance.



  • "Image.source":http://qt-project.org/doc/qt-4.8/qml-image.html#source-prop is a URL, and '#' is a reserved character in URLs, you need to url-escape it as %23.
    @
    Image {
    id: bgImage
    width: rectMain.width
    height: rectMain.height
    fillMode: Image.Stretch
    smooth: true
    z: 0
    opacity: 0.940
    source: "file://C:/Users/Main/Music/music/Agneepath%23/Agneepath.png"
    }
    @



  • Hi,
    I tried this but this is also not working. Have you any other idea?


Log in to reply