Classes | GUI > Accessories

FileDialog : QObject : Object

Operating system interface for Open file, save file, select directory dialogs
Subclasses: QFileDialog


This is the interface for your standard operating system modal file dialogs to open files, save files and select directories.

Dialog has functions built on top of FileDialog that may be more convenient to use. However, selecting a directory is only possible with FileDialog.

Class Methods, cancelFunc, fileMode: 1, acceptMode: 0, stripResult: false, path)

Create and display a dialog.



Handler function evaluated when the user clicks "Open" or "Save". This function receives different arguments depending on the value of stripResult. By default (stripResult: false), okFunc is passed an array of selected paths. Otherwise, the paths are passed as separate arguments, one for each path.


Handler function evaluated when the user clicks "Cancel". Receives no arguments.


An integer that determines the type of dialog.

These values correspond directly to values of QFileDialog::FileMode in the Qt class.

  • 0 The name of a file, whether it exists or not.
  • 1 The name of a single existing file.
  • 2 The name of a directory. Both files and directories are displayed.
  • 3 The names of zero or more existing files.

0 or 3 implies that the user can type in a new file name.


An integer that determines whether the dialog is for opening or saving files. Note that this doesn't actually open or save a file; you'll need to do that in your okFunc. This only affects appearance of the dialog.

These values correspond directly to values of QFileDialog::AcceptMode in the Qt class.

  • 0 Opening
  • 1 Saving

A boolean. If true, selected paths are passed individually as arguments to okFunc. Otherwise, they are passed as an array in a single argument (the default).

  • false: okFunc(paths)
  • true: okFunc(path1, path2, path3)

A string. The dialog will initially display the contents of this path. The default is the current user's home directory.


a FileDialog

Inherited class methods

Instance Methods

Inherited instance methods