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

using local server path in QML



  • Hello,

    I need to access to folder from my server with path:

    //DGS1109N007/Echanges/Affichage/Display/Messages/

    it working fine in c++
    example:

    QFile::remove"//DGS1109N007/Echanges/soft/Kardex/Databases/4967df1f72da4cc275387bc5c81774de.ini");
    

    but qml don't accept it with "file://///DGS1109N007/Echanges/Affichage/Display/Messages/image.jpg"

    I try to create string variable with:

    property string filepath:"//DGS1109N007/Echanges/Affichage/Display/Messages/image.jpg"
    

    and do:

    Image{
    source:"file:///"+filepath
    }
    

    but no success
    I need to display an Image, how can I do it please?

    Thank you very much for your help


  • Qt Champions 2017

    @filipdns said in using local server path in QML:

    "file:///"

    Did you get a chance to use the API Qt.resolvedUrl("file:///") method ? like follows.

    source: Qt.resolvedUrl("file:///")
    


  • @dheerendra Hello, thanks it's working fine with:

    property string filepath:"//DGS1109N007/Echanges/Affichage/Display/Messages/image.jpg"
    
    source: Qt.resolvedUrl("file:"+filepath)```
    
    with Qt.resolvedUrl don't put /// after file:


  • @filipdns if your issue is solved, please don't forget to mark you post as such! thanks.


Log in to reply