AtlasFileField
A file chooser: a path field and a Browse button that opens the system file dialog.
Since 1.4.0
AtlasFileField is a text field with the path and a Browse button that opens the system file dialog (through the file chooser portal under Plasma). path is the text; url is the same as a file URL. ~ and ~/... mean the home folder, and a path that is not absolute gives an empty url. With saveMode the dialog asks for a name to save to, otherwise for an existing file. See AtlasFolderField for a folder.
Example
AtlasFileField {
placeholderText: qsTr("Choose a file")
nameFilters: [qsTr("Documents (*.pdf *.odt)")]
onEdited: settings.report = path
Accessible.name: qsTr("Report file")
}Note
Nothing is run through a shell. The dialog is made on first use.
Properties
| Name | Type | Default | Description |
|---|---|---|---|
editable |
bool |
true |
false leaves only the button: the path cannot be typed, only chosen. |
nameFilters |
list<string> |
[] |
The dialog's filters, such as ["Images (*.png *.jpg)", "All files (*)"]. |
path |
string |
"" |
The path as text. |
placeholderText |
string |
"" |
Hint shown while the field is empty. |
saveMode |
bool |
false |
true asks for a file to save to, false for one to open. |
title |
string |
"" |
The dialog's title; empty for the system's own. |
url |
url (read-only) |
— | path as a file URL; empty when path is empty or not absolute. |
Signals
| Name | Description |
|---|---|
edited() |
The user typed a path or chose one. Not emitted when the app sets path. |