Important: Please read the Qt Code of Conduct -

QML FileDialog set folder.

  • Hey!

    I am trying to preset the folder path for my FileDialog.
    I got from the documentation that I need to specify a Url for it to work (folder : url).

    So I tried this:

    onClicked: {
    getFilePath.folder = masterResource.testPath; // Doesnt work. tried this approach where the testPath is a QUrl.
    getFilePath.folder = "file:///" + masterResource.pathWork //tried this approach, where pathWork is a QString. This works. But I suspect that the "file:///" comes automatically. Cause when I even write "file:" instead of "file:///" the output is still "file:///". So it works in some cases.


    Even though there written beside each other now I tried them separately. It seems no matter what I write in front of my path it just removes it and puts "file:///" instead. Which is not good, cause sometimes I need it to be only "file://" (notice only two "/".)

    Do anyone know the solution to this problem?

  • Get this error all the time....:

    @shellItem: SHCreateItemFromParsingName(/mypath)) failed (An attempt was made to reference a token that does not exist.)@

Log in to reply