IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

FolderDialog QML Type

A native folder dialog.

This type was introduced in Qt 6.3.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

FolderDialog QML Type

  • Import Statement: import QtQuick.Dialogs

  • Since:: Qt 6.3

  • Inherits:: Dialog

Detailed Description

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

Image non disponible

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.

 
Sélectionnez
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:

  • 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

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

See also rejectLabel

currentFolder : url

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

See Also

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:

Constant

Description

FolderDialog.DontResolveSymlinks

Don't resolve symlinks in the folder dialog. By default symlinks are resolved.

FolderDialog.ReadOnly

Indicates that the dialog doesn't allow creating directories.

FolderDialog.DontUseNativeDialog

Forces 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

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

See also currentFolder, accepted()

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+