Dumbo
Dumbo

Reputation: 14102

Using FileDialog to browse for a folder in QtQuick

I am trying to figure out how to setup the FileDialog of QtQuick.Dialogs 1.2 to select a folder instead of file(s) with no success so far. Here is my code. The user should select at least 1 file so that the FileDialog accept button works.

FileDialog {
    id:dialogFile;
    title: "Please select folder which contains positive training data";
    folder: shortcuts.home;

    onAccepted: {
        console.log("User has selected " + dialogFile.folder);
    }
}

Is there any settings/tricks to make this only browse for folder, something like the FolderBrowserDialog in .NET?

Upvotes: 5

Views: 5888

Answers (1)

nfranklin
nfranklin

Reputation: 405

You should set your FileDialog's selectFolder property to true.

See the documentation for further details.

Upvotes: 7

Related Questions