Access default image path



  • Hi,
    I search how access the pathname on the default folder of image with qml ? For an example i have used a camera + video output to capture an image. By default the program save the picture in the default directory on the OS, linux, android, etc ....

    But i would like to know the default path. I see the QStandardPaths but don't understand hos use it.

    Thanks

    Stéphane


  • Lifetime Qt Champion

    Hi,

    Do you mean you don't know how to use it from QML ?



  • Hi,

    Exactly. finally find a solution from main.cpp , but i hope there is a solution directly from qml and not using c++. See what i find :

        const QStringList imgloc = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
        QUrl wlimgloc;
    
        wlimgloc = QString("%1").arg(imgloc.first());
    
        QQmlApplicationEngine engine;
    
        engine.rootContext()->setContextProperty("montoto", wlimgloc);
        engine.load(QUrl(QLatin1String("qrc:/main.qml")));
    

    Thanks

    Stéphane


  • Lifetime Qt Champion

    Since 5.8 there's the StandardPaths QML Type.


Log in to reply
 

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