A native folder dialog. 更多...
import 语句: | import QtQuick.Dialogs |
Since: | Qt 6.3 |
继承: |
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 ()。 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 }
A native platform folder dialog is currently available on the following platforms:
Qt Quick Dialogs uses a Qt Quick implementation as a fallback on platforms that do not have a native implementation available.
另请参阅 FileDialog and StandardPaths .
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 打开 .
默认值为空字符串。
另请参阅 rejectLabel .
currentFolder : url |
This property holds the folder that is currently being displayed in the dialog.
另请参阅 selectedFolder .
options : flags |
This property holds the various options that affect the look and feel of the dialog.
默认情况下,所有选项是被禁用的。
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:
常量 | 描述 |
---|---|
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 .
默认值为空字符串。
另请参阅 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.
另请参阅 currentFolder and accepted ().