FileDialog

Search for usage in LXR

FileDialog Class Reference

Public Types

enum class  Modes { Open , Save }
 

Properties

alias browser
 
var callback
 
alias currentPath
 
int mode
 
bool searchBar
 
alias selectionBar
 
alias singleSelection
 
string suggestedFileName
 
alias textField
 

Signals

void finished (var urls)
 
void urlsSelected (var urls)
 

Detailed Description

A dialog to quickly select files for opening or saving.

This controls inherits from MauiKit PopupPage, to checkout its inherited properties refer to the docs.

See also
MauiKit::PopupPage
Note
This component makes use of the FileBrowser.

The FileDialog can be in two modes, one for Opening and other for Saving files.

The file dialog allows to have multiple or single selection, and filtering content specific to a file type or arbitrary name filters.

Maui.Page
{
Maui.Controls.showCSD: true
anchors.fill: parent
Column
{
width: 100
anchors.centerIn: parent
{
text: "Open"
onClicked:
{
_dialog.mode = FB.FileDialog.Modes.Open
_dialog.callback = (paths) =>
{
console.log("Selected Paths", paths)
_text.text = paths.join("\n")
}
_dialog.open()
}
}
{
text: "Save"
onClicked:
{
_dialog.mode = FB.FileDialog.Modes.Save
_dialog.callback = (paths) =>
{
console.log("Save to", paths)
_text.text = paths.join("\n")
}
_dialog.open()
}
}
{
id: _text
}
}
}
FB.FileDialog
{
id: _dialog
}

You can find a more complete example at this link.

Definition at line 98 of file FileDialog.qml.

Member Enumeration Documentation

◆ Modes

enum class FileDialog::Modes
strong

The two different modes to use with this dialog.

Enumerator
Open 

To use this dialog for selecting one or multiple entries for opening.

Save 

To use this dialog to select a single directory where to save a file entry with a given name.

Definition at line 145 of file FileDialog.qml.

Property Documentation

◆ browser

alias FileDialog::browser
read

The FileBrowser used for listing.

Remarks
This property is read-only

For more details on how it works check its documentation.

Definition at line 117 of file FileDialog.qml.

◆ callback

var FileDialog::callback
read

A callback function that will be invoked once the user is done selecting the files.

This is useful when the file dialog is going to be used for multiple purposes. Otherwise you might want to use the urlsSelected signal.

See also
urlsSelected

Definition at line 167 of file FileDialog.qml.

◆ currentPath

alias FileDialog::currentPath
read

The current path of the directory URL.

See also
FileBrowser::currentPath

Definition at line 110 of file FileDialog.qml.

◆ mode

int FileDialog::mode
read

The current mode in use.

By default this is set to FileDialog.Modes.Open

See also
Modes

Definition at line 160 of file FileDialog.qml.

◆ searchBar

bool FileDialog::searchBar
read

Show the search bar to enter a search query.

Definition at line 138 of file FileDialog.qml.

◆ selectionBar

alias FileDialog::selectionBar
read
Remarks
This property is read-only
See also
FileBrowser::selectionBar This control already has a predefined SelectionBar, and can be accessed via this alias.

Definition at line 124 of file FileDialog.qml.

◆ singleSelection

alias FileDialog::singleSelection
read

If true then only one item can be selected, either for saving or for opening.

Definition at line 129 of file FileDialog.qml.

◆ suggestedFileName

string FileDialog::suggestedFileName
read

On save mode a text field is visible and this property is used to assign its default text value.

By default this is set to empty string

Definition at line 134 of file FileDialog.qml.

◆ textField

alias FileDialog::textField
read

On Save mode a text field is visible, this property gives access to it.

Remarks
This property is read-only

Definition at line 172 of file FileDialog.qml.

Member Function Documentation

◆ finished

void FileDialog::finished ( var urls)
signal

Emitted once the selection has been done.

Parameters
urlsthe selected list of URLs

◆ urlsSelected

void FileDialog::urlsSelected ( var urls)
signal

Emitted once the URLs have been selected.

Parameters
urlsthe selected list of URLs

The documentation for this class was generated from the following file:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.