QFileDialog QML Type | Qt Installer Framework Manual

Qt Installer Framework Manual

# QFileDialog QML Type

Provides a dialog that allows users to select files or directories. More...

Import Statement: | import scripting .

- List of all members, including inherited members

## Methods

- string getExistingDirectory(string caption, string dir)
- string getOpenFileName(string caption, string dir, string filter)

## Detailed Description

Use the QFileDialog::getExistingDirectory() method to create a modal dialog that displays an existing directory selected by the user. Use the QFileDialog::getOpenFileName() method to create a dialog that displays matching files in the directory selected by the user.

## Method Documentation

string getExistingDirectory(string caption, string dir)

Returns an existing directory selected by the user.

The dialog's working directory is set to dir, and the caption is set to caption. Either of these may be an empty string, in which case the current directory and a default caption will be used, respectively.

string getOpenFileName(string caption, string dir, string filter)

Returns an existing file selected by the user. If the user selects Cancel, returns a null string.

The file dialog's caption is set to caption. If `caption` is not specified, a default caption is used.

The file dialog's working directory is set to dir. If `dir` includes a file name, the file will be selected. Only files that match the specified filter are shown. Either of these may be an empty string.

To specify multiple filters, separate them with two semicolons (;;). For example:

      "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"

On Windows, and OS X, this static function will use the native file dialog and not a QFileDialog.