FolderDialog QML Type

A native folder dialog. More...

Import Statement: import QtQuick.Dialogs
Since: Qt 6.3
Inherits:

Dialog

Properties

Detailed Description

The FolderDialog type provides a QML API for native platform folder dialogs.

To show a folder dialog, construct an instance of FolderDialog, set the desired properties, and call open(). The currentFolder property can be used to determine the folder that is currently being displayed in the dialog. The selectedFolder property can be used to determine the last folder that was selected in the dialog.

 MenuItem {
     text: qsTr("Open...")
     onTriggered: folderDialog.open()
 }

 FolderDialog {
     id: folderDialog
     currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
     selectedFolder: viewer.folder
 }

 MyViewer {
     id: viewer
     folder: folderDialog.selectedFolder
 }

Availability

A native platform folder dialog is currently available on the following platforms:

  • Android
  • iOS
  • Linux (when running with the GTK+ platform theme)
  • macOS
  • Windows

Qt Quick Dialogs uses a Qt Quick implementation as a fallback on platforms that do not have a native implementation available.

See also FileDialog and StandardPaths.

Property Documentation

acceptLabel : string

This property holds the label text shown on the button that accepts the dialog.

When set to an empty string, the default label of the underlying platform is used. The default label is typically Open.

The default value is an empty string.

See also rejectLabel.


currentFolder : url

This property holds the folder that is currently being displayed in the dialog.

See also selectedFolder.


options : flags

This property holds the various options that affect the look and feel of the dialog.

By default, all options are disabled.

Options should be set before showing the dialog. Setting them while the dialog is visible is not guaranteed to have an immediate effect on the dialog (depending on the option and on the platform).

Available options:

ConstantDescription
FolderDialog.DontResolveSymlinksDon't resolve symlinks in the folder dialog. By default symlinks are resolved.
FolderDialog.ReadOnlyIndicates that the dialog doesn't allow creating directories.
FolderDialog.DontUseNativeDialogForces the dialog to use a non-native quick implementation.

rejectLabel : string

This property holds the label text shown on the button that rejects the dialog.

When set to an empty string, the default label of the underlying platform is used. The default label is typically Cancel.

The default value is an empty string.

See also acceptLabel.


selectedFolder : url

This property holds the last folder that was selected in the dialog.

The value of this property is updated each time the user selects a folder in the dialog, and when the dialog is accepted. Alternatively, the accepted() signal can be handled to get the final selection.

See also currentFolder and accepted().