com.trolltech.qt.gui
Class QFileDialog

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QObject
                  extended by com.trolltech.qt.gui.QWidget
                      extended by com.trolltech.qt.gui.QDialog
                          extended by com.trolltech.qt.gui.QFileDialog
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QFileDialog
extends QDialog

The QFileDialog class provides a dialog that allow users to select files or directories. The QFileDialog class enables a user to traverse the file system in order to select one or many files or a directory.

The easiest way to create a QFileDialog is to use the static functions. On Windows, these static functions will call the native Windows file dialog, and on Mac OS X these static function will call the native Mac OS X file dialog.

  String fileName = QFileDialog.getOpenFileName(this,
      tr("Open Image"), "/home/jana", new QFileDialog.Filter(tr("Image Files (*.png *.jpg *.bmp)")));
In the above example, a modal QFileDialog is created using a static function. The dialog initially displays the contents of the "/home/jana" directory, and displays files matching the patterns given in the string "Image Files (*.png *.jpg *.bmp)". The parent of the file dialog is set to this, and the window title is set to "Open Image".

If you want to use multiple filters, separate each one with two semicolons. For example:

  String filter = "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)";
You can create your own QFileDialog without using the static functions. By calling setFileMode(), you can specify what the user must select in the dialog:
  QFileDialog dialog = new QFileDialog(this);
  dialog.setFileMode(QFileDialog.FileMode.AnyFile);
In the above example, the mode of the file dialog is set to AnyFile , meaning that the user can select any file, or even specify a file that doesn't exist. This mode is useful for creating a "Save As" file dialog. Use ExistingFile if the user must select an existing file, or Directory if only a directory may be selected. See the QFileDialog::FileMode enum for the complete list of modes.

The fileMode property contains the mode of operation for the dialog; this indicates what types of objects the user is expected to select. Use setNameFilter() to set the dialog's file filter. For example:

  dialog.setFilter(tr("Images (*.png *.xpm *.jpg)"));
In the above example, the filter is set to "Images (*.png *.xpm *.jpg)", this means that only files with the extension png, xpm, or jpg will be shown in the QFileDialog. You can apply several filters by using setNameFilters(). Use selectNameFilter() to select one of the filters you've given as the file dialog's default filter.

The file dialog has two view modes: List and Detail . List presents the contents of the current directory as a list of file and directory names. Detail also displays a list of file and directory names, but provides additional information alongside each name, such as the file size and modification date. Set the mode with setViewMode():

  dialog.setViewMode(QFileDialog.ViewMode.Detail);
The last important function you will need to use when creating your own file dialog is selectedFiles().
  java.util.List fileNames;
  if (dialog.exec() != 0)
      fileNames = dialog.selectedFiles();
In the above example, a modal file dialog is created and shown. If the user clicked OK, the file they selected is put in fileName.

The dialog's working directory can be set with setDirectory(). Each file in the current directory can be selected using the selectFile() function.

The Standard Dialogs example shows how to use QFileDialog as well as other built-in Qt dialogs.

See also:
QDir, QFileInfo, QFile, QPrintDialog, QColorDialog, QFontDialog, Standard Dialogs Example, and Application Example.


Nested Class Summary
static class QFileDialog.AcceptMode
           
static class QFileDialog.DialogLabel
           
static class QFileDialog.FileMode
          This enum is used to indicate what the user may select in the file dialog; i.e.
static class QFileDialog.Filter
           
static class QFileDialog.Option
          This value is obsolete and does nothing since Qt 4.5:
static class QFileDialog.Options
           
static class QFileDialog.ViewMode
          This enum describes the view mode of the file dialog; i.e.
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QDialog
QDialog.DialogCode
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
QWidget.RenderFlag, QWidget.RenderFlags
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 QSignalEmitter.Signal1 currentChanged
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal1 directoryEntered
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal1 fileSelected
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal1 filesSelected
          This signal takes 1 generic argument(s).
 QSignalEmitter.Signal1 filterSelected
          This signal takes 1 generic argument(s).
 
Fields inherited from class com.trolltech.qt.gui.QDialog
accepted, finished, rejected
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QFileDialog()
          Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory.
QFileDialog(QWidget parent)
          Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory.
QFileDialog(QWidget parent, Qt.WindowFlags f)
          Constructs a file dialog with the given parent and widget flags.
QFileDialog(QWidget parent, Qt.WindowType[] f)
           
QFileDialog(QWidget parent, java.lang.String caption)
          Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory.
QFileDialog(QWidget parent, java.lang.String caption, java.lang.String directory)
          Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory.
QFileDialog(QWidget parent, java.lang.String caption, java.lang.String directory, java.lang.String filter)
          Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory.
 
Method Summary
 QFileDialog.AcceptMode acceptMode()
          This property holds the accept mode of the dialog.
 boolean confirmOverwrite()
          See also.
setConfirmOverwrite().
 java.lang.String defaultSuffix()
          This property holds suffix added to the filename if no other suffix was specified.
 QDir directory()
          Returns the directory currently being displayed in the dialog.
 QFileDialog.FileMode fileMode()
          This property holds the file mode of the dialog.
 QDir.Filters filter()
          Returns the filter that is used when displaying files.
 java.util.List filters()
          Use nameFilters() instead.
static java.lang.String getExistingDirectory()
          This is a convenience static function that will return an existing directory selected by the user.
static java.lang.String getExistingDirectory(QWidget parent)
          This is a convenience static function that will return an existing directory selected by the user.
static java.lang.String getExistingDirectory(QWidget parent, java.lang.String caption)
          This is a convenience static function that will return an existing directory selected by the user.
static java.lang.String getExistingDirectory(QWidget parent, java.lang.String caption, java.lang.String dir)
          This is a convenience static function that will return an existing directory selected by the user.
static java.lang.String getExistingDirectory(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Option[] options)
           
static java.lang.String getExistingDirectory(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Options options)
          This is a convenience static function that will return an existing directory selected by the user.
static java.lang.String getOpenFileName()
          This is an overloaded function provided for convenience.
static java.lang.String getOpenFileName(QWidget parent)
          This is an overloaded function provided for convenience.
static java.lang.String getOpenFileName(QWidget parent, java.lang.String caption)
          This is an overloaded function provided for convenience.
static java.lang.String getOpenFileName(QWidget parent, java.lang.String caption, java.lang.String dir)
          This is an overloaded function provided for convenience.
static java.lang.String getOpenFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter)
          This is a convenience static function that returns an existing file selected by the user.
static java.lang.String getOpenFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Option[] options)
          This is a convenience static function that returns an existing file selected by the user.
static java.lang.String getOpenFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Options options)
          This is a convenience static function that returns an existing file selected by the user.
static java.util.List getOpenFileNames()
          This is an overloaded function provided for convenience.
static java.util.List getOpenFileNames(QWidget parent)
          This is an overloaded function provided for convenience.
static java.util.List getOpenFileNames(QWidget parent, java.lang.String caption)
          This is an overloaded function provided for convenience.
static java.util.List getOpenFileNames(QWidget parent, java.lang.String caption, java.lang.String dir)
          This is an overloaded function provided for convenience.
static java.util.List getOpenFileNames(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter)
          This is a convenience static function that will return one or more existing files selected by the user.
static java.util.List getOpenFileNames(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Option[] options)
          This is a convenience static function that will return one or more existing files selected by the user.
static java.util.List getOpenFileNames(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Options options)
          This is a convenience static function that will return one or more existing files selected by the user.
static java.lang.String getSaveFileName()
          This is an overloaded function provided for convenience.
static java.lang.String getSaveFileName(QWidget parent)
          This is an overloaded function provided for convenience.
static java.lang.String getSaveFileName(QWidget parent, java.lang.String caption)
          This is an overloaded function provided for convenience.
static java.lang.String getSaveFileName(QWidget parent, java.lang.String caption, java.lang.String dir)
          This is an overloaded function provided for convenience.
static java.lang.String getSaveFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter)
          This is a convenience static function that will return a file name selected by the user.
static java.lang.String getSaveFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Option[] options)
          This is a convenience static function that will return a file name selected by the user.
static java.lang.String getSaveFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Options options)
          This is a convenience static function that will return a file name selected by the user.
 java.util.List history()
          Returns the browsing history of the filedialog as a list of paths.
 QFileIconProvider iconProvider()
          Returns the icon provider used by the filedialog.
 boolean isNameFilterDetailsVisible()
           
 boolean isReadOnly()
           
 QAbstractItemDelegate itemDelegate()
          Returns the item delegate used to render the items in the views in the filedialog.
 java.lang.String labelText(QFileDialog.DialogLabel label)
          Returns the text shown in the filedialog in the specified label.
 java.util.List nameFilters()
          Returns the file type filters that are in operation on this file dialog.
 QFileDialog.Options options()
          This property holds the various options that affect the look and feel of the dialog.
 QAbstractProxyModel proxyModel()
          Returns the proxy model used by the file dialog.
 boolean resolveSymlinks()
          See also.
setResolveSymlinks().
 boolean restoreState(QByteArray state)
          Restores the dialogs's layout, history and current directory to the state specified.
 QByteArray saveState()
          Saves the state of the dialog's layout, history and current directory.
 java.util.List selectedFiles()
          Returns a list of strings containing the absolute paths of the selected files in the dialog.
 java.lang.String selectedFilter()
          Use selectedNameFilter() instead.
 java.lang.String selectedNameFilter()
          Returns the filter that the user selected in the file dialog.
 void selectFile(java.lang.String filename)
          Selects the given filename in the file dialog.
 void selectFilter(java.lang.String filter)
          Use selectNameFilter() instead.
 void selectNameFilter(java.lang.String filter)
          Sets the current file type filter.
 void setAcceptMode(QFileDialog.AcceptMode mode)
          This property holds the accept mode of the dialog.
 void setConfirmOverwrite(boolean enabled)
          See also.
confirmOverwrite().
 void setDefaultSuffix(java.lang.String suffix)
          This property holds suffix added to the filename if no other suffix was specified.
 void setDirectory(QDir directory)
          Set the current directory of this QFileDialog to directory.
 void setDirectory(java.lang.String directory)
          Sets the file dialog's current directory.
 void setFileMode(QFileDialog.FileMode mode)
          This property holds the file mode of the dialog.
 void setFilter(QDir.Filter[] filters)
           
 void setFilter(QDir.Filters filters)
          Sets the filter used by the model to filters.
 void setFilter(java.lang.String filter)
          Use setNameFilter() instead.
 void setFilters(java.util.List filters)
          Use setNameFilters() instead.
 void setHistory(java.util.List paths)
          Sets the browsing history of the filedialog to contain the given paths.
 void setIconProvider(QFileIconProvider provider)
          Sets the icon provider used by the filedialog to the specified provider.
 void setItemDelegate(QAbstractItemDelegate delegate)
          Sets the item delegate used to render items in the views in the file dialog to the given delegate.
 void setLabelText(QFileDialog.DialogLabel label, java.lang.String text)
          Sets the text shown in the filedialog in the specified label.
 void setNameFilter(java.lang.String filter)
          Sets the filter used in the file dialog to the given filter.
 void setNameFilterDetailsVisible(boolean enabled)
          See also.
isNameFilterDetailsVisible().
 void setNameFilters(java.util.List filters)
          Sets the filters used in the file dialog.
 void setOption(QFileDialog.Option option)
          Sets the given option to be enabled if on is true; otherwise, clears the given option.
 void setOption(QFileDialog.Option option, boolean on)
          Sets the given option to be enabled if on is true; otherwise, clears the given option.
 void setOptions(QFileDialog.Option[] options)
          This is an overloaded method provided for convenience.
 void setOptions(QFileDialog.Options options)
          This property holds the various options that affect the look and feel of the dialog.
 void setProxyModel(QAbstractProxyModel model)
          Sets the model for the views to the given proxyModel.
 void setReadOnly(boolean enabled)
          See also.
isReadOnly().
 void setResolveSymlinks(boolean enabled)
          See also.
resolveSymlinks().
 void setSidebarUrls(java.util.List urls)
          Sets the urls that are located in the sidebar.
 void setViewMode(QFileDialog.ViewMode mode)
          This property holds the way files and directories are displayed in the dialog.
 java.util.List sidebarUrls()
          Returns a list of urls that are currently in the sidebar
 boolean testOption(QFileDialog.Option option)
          Returns true if the given option is enabled; otherwise, returns false.
 QFileDialog.ViewMode viewMode()
          This property holds the way files and directories are displayed in the dialog.
 
Methods inherited from class com.trolltech.qt.gui.QDialog
accept, done, exec, isSizeGripEnabled, open, reject, result, setModal, setResult, setSizeGripEnabled
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, graphicsProxyWidget, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

currentChanged

public final QSignalEmitter.Signal1 currentChanged

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.String(named: path)>:

When the current file changes, this signal is emitted with the new file name as the path parameter.

See also:
filesSelected() .


directoryEntered

public final QSignalEmitter.Signal1 directoryEntered

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.String(named: directory)>:

This signal is emitted when the user enters a directory.


fileSelected

public final QSignalEmitter.Signal1 fileSelected

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.String(named: file)>:

When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empty) selected file.

See also:
currentChanged() , and QDialog::Accepted .


filesSelected

public final QSignalEmitter.Signal1 filesSelected

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.util.List(named: selected)>:

When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empty) list of selected files.

See also:
currentChanged() , and QDialog::Accepted .


filterSelected

public final QSignalEmitter.Signal1 filterSelected

This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.String(named: filter)>:

This signal is emitted when the user selects a filter.

Constructor Detail

QFileDialog

public QFileDialog(QWidget parent,
                   Qt.WindowType[] f)

QFileDialog

public QFileDialog(QWidget parent,
                   Qt.WindowFlags f)
Constructs a file dialog with the given parent and widget flags.


QFileDialog

public QFileDialog(QWidget parent,
                   java.lang.String caption,
                   java.lang.String directory)
Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory. The contents of the directory are filtered before being shown in the dialog, using a semicolon-separated list of filters specified by filter.


QFileDialog

public QFileDialog(QWidget parent,
                   java.lang.String caption)
Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory. The contents of the directory are filtered before being shown in the dialog, using a semicolon-separated list of filters specified by filter.


QFileDialog

public QFileDialog(QWidget parent)
Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory. The contents of the directory are filtered before being shown in the dialog, using a semicolon-separated list of filters specified by filter.


QFileDialog

public QFileDialog()
Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory. The contents of the directory are filtered before being shown in the dialog, using a semicolon-separated list of filters specified by filter.


QFileDialog

public QFileDialog(QWidget parent,
                   java.lang.String caption,
                   java.lang.String directory,
                   java.lang.String filter)
Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory. The contents of the directory are filtered before being shown in the dialog, using a semicolon-separated list of filters specified by filter.

Method Detail

acceptMode

public final QFileDialog.AcceptMode acceptMode()
This property holds the accept mode of the dialog. The action mode defines whether the dialog is for opening or saving files.

By default, this property is set to AcceptOpen .

See also:
AcceptMode .


confirmOverwrite

public final boolean confirmOverwrite()

See also.
setConfirmOverwrite().


defaultSuffix

public final java.lang.String defaultSuffix()
This property holds suffix added to the filename if no other suffix was specified. This property specifies a string that will be added to the filename if it has no suffix already. The suffix is typically used to indicate the file type (e.g. "txt" indicates a text file).


directory

public final QDir directory()
Returns the directory currently being displayed in the dialog.

See also:
setDirectory().


fileMode

public final QFileDialog.FileMode fileMode()
This property holds the file mode of the dialog. The file mode defines the number and type of items that the user is expected to select in the dialog.

By default, this property is set to AnyFile .

This function will set the labels for the FileName and Accept DialogLabel s. It is possible to set custom text after the call to setFileMode().

See also:
FileMode .


filter

public final QDir.Filters filter()
Returns the filter that is used when displaying files.

See also:
setFilter().


filters

public final java.util.List filters()
Use nameFilters() instead.

See also:
setFilters().


history

public final java.util.List history()
Returns the browsing history of the filedialog as a list of paths.

See also:
setHistory().


iconProvider

public final QFileIconProvider iconProvider()
Returns the icon provider used by the filedialog.

See also:
setIconProvider().


isNameFilterDetailsVisible

public final boolean isNameFilterDetailsVisible()

isReadOnly

public final boolean isReadOnly()

itemDelegate

public final QAbstractItemDelegate itemDelegate()
Returns the item delegate used to render the items in the views in the filedialog.

See also:
setItemDelegate().


labelText

public final java.lang.String labelText(QFileDialog.DialogLabel label)
Returns the text shown in the filedialog in the specified label.

See also:
setLabelText().


nameFilters

public final java.util.List nameFilters()
Returns the file type filters that are in operation on this file dialog.

See also:
setNameFilters().


options

public final QFileDialog.Options options()
This property holds the various options that affect the look and feel of the dialog. By default, all options are disabled.

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).

See also:
setOption(), and testOption().


proxyModel

public final QAbstractProxyModel proxyModel()
Returns the proxy model used by the file dialog. By default no proxy is set.

See also:
setProxyModel().


resolveSymlinks

public final boolean resolveSymlinks()

See also.
setResolveSymlinks().


restoreState

public final boolean restoreState(QByteArray state)
Restores the dialogs's layout, history and current directory to the state specified.

Typically this is used in conjunction with QSettings to restore the size from a past session.

Returns false if there are errors


saveState

public final QByteArray saveState()
Saves the state of the dialog's layout, history and current directory.

Typically this is used in conjunction with QSettings to remember the size for a future session. A version number is stored as part of the data.


selectFile

public final void selectFile(java.lang.String filename)
Selects the given filename in the file dialog.

See also:
selectedFiles().


selectFilter

public final void selectFilter(java.lang.String filter)
Use selectNameFilter() instead.


selectNameFilter

public final void selectNameFilter(java.lang.String filter)
Sets the current file type filter. Multiple filters can be passed in filter by separating them with semicolons or spaces.

See also:
setNameFilter(), setNameFilters(), and selectedNameFilter().


selectedFiles

public final java.util.List selectedFiles()
Returns a list of strings containing the absolute paths of the selected files in the dialog. If no files are selected, or the mode is not ExistingFiles or ExistingFile , selectedFiles() contains the current path in the viewport.

See also:
selectedNameFilter(), and selectFile().


selectedFilter

public final java.lang.String selectedFilter()
Use selectedNameFilter() instead.


selectedNameFilter

public final java.lang.String selectedNameFilter()
Returns the filter that the user selected in the file dialog.

See also:
selectedFiles().


setAcceptMode

public final void setAcceptMode(QFileDialog.AcceptMode mode)
This property holds the accept mode of the dialog. The action mode defines whether the dialog is for opening or saving files.

By default, this property is set to AcceptOpen .

See also:
AcceptMode .


setConfirmOverwrite

public final void setConfirmOverwrite(boolean enabled)

See also.
confirmOverwrite().


setDefaultSuffix

public final void setDefaultSuffix(java.lang.String suffix)
This property holds suffix added to the filename if no other suffix was specified. This property specifies a string that will be added to the filename if it has no suffix already. The suffix is typically used to indicate the file type (e.g. "txt" indicates a text file).


setDirectory

public final void setDirectory(QDir directory)
Set the current directory of this QFileDialog to directory.


setDirectory

public final void setDirectory(java.lang.String directory)
Sets the file dialog's current directory.

See also:
directory().


setFileMode

public final void setFileMode(QFileDialog.FileMode mode)
This property holds the file mode of the dialog. The file mode defines the number and type of items that the user is expected to select in the dialog.

By default, this property is set to AnyFile .

This function will set the labels for the FileName and Accept DialogLabel s. It is possible to set custom text after the call to setFileMode().

See also:
FileMode .


setFilter

public final void setFilter(QDir.Filter[] filters)

setFilter

public final void setFilter(QDir.Filters filters)
Sets the filter used by the model to filters. The filter is used to specify the kind of files that should be shown.

See also:
filter().


setFilter

public final void setFilter(java.lang.String filter)
Use setNameFilter() instead.


setFilters

public final void setFilters(java.util.List filters)
Use setNameFilters() instead.

See also:
filters().


setHistory

public final void setHistory(java.util.List paths)
Sets the browsing history of the filedialog to contain the given paths.

See also:
history().


setIconProvider

public final void setIconProvider(QFileIconProvider provider)
Sets the icon provider used by the filedialog to the specified provider.

See also:
iconProvider().


setItemDelegate

public final void setItemDelegate(QAbstractItemDelegate delegate)
Sets the item delegate used to render items in the views in the file dialog to the given delegate.

Warning: You should not share the same instance of a delegate between views. Doing so can cause incorrect or unintuitive editing behavior since each view connected to a given delegate may receive the closeEditor() signal, and attempt to access, modify or close an editor that has already been closed.

See also:
itemDelegate().


setLabelText

public final void setLabelText(QFileDialog.DialogLabel label,
                               java.lang.String text)
Sets the text shown in the filedialog in the specified label.

See also:
labelText().


setNameFilter

public final void setNameFilter(java.lang.String filter)
Sets the filter used in the file dialog to the given filter.

If filter contains a pair of parentheses containing one or more of anything*something, separated by spaces, then only the text contained in the parentheses is used as the filter. This means that these calls are all equivalent:

       dialog.setFilter("All C++ files (*.cpp *.cc *.C *.cxx *.c++)");
       dialog.setFilter("*.cpp;*.cc;*.C;*.cxx;*.c++");

See also:
setNameFilters().


setNameFilterDetailsVisible

public final void setNameFilterDetailsVisible(boolean enabled)

See also.
isNameFilterDetailsVisible().


setNameFilters

public final void setNameFilters(java.util.List filters)
Sets the filters used in the file dialog.
      java.util.ArrayList<String> filters = new java.util.ArrayList<String>();
      filters.add("Image files (*.png *.xpm *.jpg)");
      filters.add("Text files (*.txt)");
      filters.add("Any files (*)");

      QFileDialog dlg = new QFileDialog(this);
      dlg.setFilters(filters);
      dlg.exec();

See also:
nameFilters().


setOption

public final void setOption(QFileDialog.Option option)
Sets the given option to be enabled if on is true; otherwise, clears the given option.

See also:
options, and testOption().


setOption

public final void setOption(QFileDialog.Option option,
                            boolean on)
Sets the given option to be enabled if on is true; otherwise, clears the given option.

See also:
options, and testOption().


setOptions

public final void setOptions(QFileDialog.Option[] options)
This is an overloaded method provided for convenience.


setOptions

public final void setOptions(QFileDialog.Options options)
This property holds the various options that affect the look and feel of the dialog. By default, all options are disabled.

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).

See also:
setOption(), and testOption().


setProxyModel

public final void setProxyModel(QAbstractProxyModel model)
Sets the model for the views to the given proxyModel. This is useful if you want to modify the underlying model; for example, to add columns, filter data or add drives.

Any existing proxy model will be removed, but not deleted. The file dialog will take ownership of the proxyModel.

See also:
proxyModel().


setReadOnly

public final void setReadOnly(boolean enabled)

See also.
isReadOnly().


setResolveSymlinks

public final void setResolveSymlinks(boolean enabled)

See also.
resolveSymlinks().


setSidebarUrls

public final void setSidebarUrls(java.util.List urls)
Sets the urls that are located in the sidebar.

For instance:

The following code example is written in c++.

    QList<QUrl> urls;
    urls << QUrl::fromLocalFile("/home/gvatteka/dev/qt-45")
         << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));

    QFileDialog dialog;
    dialog.setSidebarUrls(urls);
    dialog.setFileMode(QFileDialog::AnyFile);
    if(dialog.exec()) {
        // ...
    }
The file dialog will then look like this:

See also:
sidebarUrls().


setViewMode

public final void setViewMode(QFileDialog.ViewMode mode)
This property holds the way files and directories are displayed in the dialog. By default, the Detail mode is used to display information about files and directories.

See also:
ViewMode .


sidebarUrls

public final java.util.List sidebarUrls()
Returns a list of urls that are currently in the sidebar

See also.
setSidebarUrls().


testOption

public final boolean testOption(QFileDialog.Option option)
Returns true if the given option is enabled; otherwise, returns false.

See also:
options, and setOption().


viewMode

public final QFileDialog.ViewMode viewMode()
This property holds the way files and directories are displayed in the dialog. By default, the Detail mode is used to display information about files and directories.

See also:
ViewMode .


getExistingDirectory

public static java.lang.String getExistingDirectory(QWidget parent,
                                                    java.lang.String caption,
                                                    java.lang.String dir,
                                                    QFileDialog.Option[] options)

getExistingDirectory

public static java.lang.String getExistingDirectory(QWidget parent,
                                                    java.lang.String caption,
                                                    java.lang.String dir)
This is a convenience static function that will return an existing directory selected by the user.
    String dir = QFileDialog.getExistingDirectory(this, tr("Open Directory"),
                                                    "/home",
                                                    QFileDialog.Option.createQFlags(
                                                    QFileDialog.Option.ShowDirsOnly,
                                                    QFileDialog.Option.DontResolveSymlinks));
This function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

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.

The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass. Note that ShowDirsOnly must be set to ensure a native file dialog.

Under Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog. On Mac OS X, the dir argument is ignored, the native dialog always displays the last visited directory. On Windows CE, if the device has no native file dialog, a QFileDialog will be used.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors.

See also:
getOpenFileName(), getOpenFileNames(), and getSaveFileName().


getExistingDirectory

public static java.lang.String getExistingDirectory(QWidget parent,
                                                    java.lang.String caption)
This is a convenience static function that will return an existing directory selected by the user.
    String dir = QFileDialog.getExistingDirectory(this, tr("Open Directory"),
                                                    "/home",
                                                    QFileDialog.Option.createQFlags(
                                                    QFileDialog.Option.ShowDirsOnly,
                                                    QFileDialog.Option.DontResolveSymlinks));
This function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

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.

The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass. Note that ShowDirsOnly must be set to ensure a native file dialog.

Under Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog. On Mac OS X, the dir argument is ignored, the native dialog always displays the last visited directory. On Windows CE, if the device has no native file dialog, a QFileDialog will be used.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors.

See also:
getOpenFileName(), getOpenFileNames(), and getSaveFileName().


getExistingDirectory

public static java.lang.String getExistingDirectory(QWidget parent)
This is a convenience static function that will return an existing directory selected by the user.
    String dir = QFileDialog.getExistingDirectory(this, tr("Open Directory"),
                                                    "/home",
                                                    QFileDialog.Option.createQFlags(
                                                    QFileDialog.Option.ShowDirsOnly,
                                                    QFileDialog.Option.DontResolveSymlinks));
This function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

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.

The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass. Note that ShowDirsOnly must be set to ensure a native file dialog.

Under Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog. On Mac OS X, the dir argument is ignored, the native dialog always displays the last visited directory. On Windows CE, if the device has no native file dialog, a QFileDialog will be used.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors.

See also:
getOpenFileName(), getOpenFileNames(), and getSaveFileName().


getExistingDirectory

public static java.lang.String getExistingDirectory()
This is a convenience static function that will return an existing directory selected by the user.
    String dir = QFileDialog.getExistingDirectory(this, tr("Open Directory"),
                                                    "/home",
                                                    QFileDialog.Option.createQFlags(
                                                    QFileDialog.Option.ShowDirsOnly,
                                                    QFileDialog.Option.DontResolveSymlinks));
This function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

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.

The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass. Note that ShowDirsOnly must be set to ensure a native file dialog.

Under Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog. On Mac OS X, the dir argument is ignored, the native dialog always displays the last visited directory. On Windows CE, if the device has no native file dialog, a QFileDialog will be used.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors.

See also:
getOpenFileName(), getOpenFileNames(), and getSaveFileName().


getExistingDirectory

public static java.lang.String getExistingDirectory(QWidget parent,
                                                    java.lang.String caption,
                                                    java.lang.String dir,
                                                    QFileDialog.Options options)
This is a convenience static function that will return an existing directory selected by the user.
    String dir = QFileDialog.getExistingDirectory(this, tr("Open Directory"),
                                                    "/home",
                                                    QFileDialog.Option.createQFlags(
                                                    QFileDialog.Option.ShowDirsOnly,
                                                    QFileDialog.Option.DontResolveSymlinks));
This function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

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.

The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass. Note that ShowDirsOnly must be set to ensure a native file dialog.

Under Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog. On Mac OS X, the dir argument is ignored, the native dialog always displays the last visited directory. On Windows CE, if the device has no native file dialog, a QFileDialog will be used.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Warning: Do not delete parent during the execution of the dialog. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors.

See also:
getOpenFileName(), getOpenFileNames(), and getSaveFileName().


getOpenFileName

public static java.lang.String getOpenFileName(QWidget parent,
                                               java.lang.String caption,
                                               java.lang.String dir,
                                               QFileDialog.Filter filter,
                                               QFileDialog.Options options)
This is a convenience static function that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.
    String fName = QFileDialog.getOpenFileName(this, tr("Open File"),
                                                    "/home",
                                                    new QFileDialog.Filter(tr("Images (*.png *.xpm *.jpg)")));
The function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. Only files that match the given filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.

The dialog's caption is set to caption. If caption is not specified then a default caption will be used.

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

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

See also:
getOpenFileNames(), getSaveFileName(), and getExistingDirectory().


getOpenFileName

public static java.lang.String getOpenFileName(QWidget parent,
                                               java.lang.String caption,
                                               java.lang.String dir,
                                               QFileDialog.Filter filter,
                                               QFileDialog.Option[] options)
This is a convenience static function that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.
    String fName = QFileDialog.getOpenFileName(this, tr("Open File"),
                                                    "/home",
                                                    new QFileDialog.Filter(tr("Images (*.png *.xpm *.jpg)")));
The function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. Only files that match the given filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.

The dialog's caption is set to caption. If caption is not specified then a default caption will be used.

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

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

See also:
getOpenFileNames(), getSaveFileName(), and getExistingDirectory().


getOpenFileName

public static java.lang.String getOpenFileName(QWidget parent,
                                               java.lang.String caption,
                                               java.lang.String dir,
                                               QFileDialog.Filter filter)
This is a convenience static function that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.
    String fName = QFileDialog.getOpenFileName(this, tr("Open File"),
                                                    "/home",
                                                    new QFileDialog.Filter(tr("Images (*.png *.xpm *.jpg)")));
The function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. Only files that match the given filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.

The dialog's caption is set to caption. If caption is not specified then a default caption will be used.

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

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

See also:
getOpenFileNames(), getSaveFileName(), and getExistingDirectory().


getOpenFileName

public static java.lang.String getOpenFileName(QWidget parent,
                                               java.lang.String caption,
                                               java.lang.String dir)
This is an overloaded function provided for convenience.


getOpenFileName

public static java.lang.String getOpenFileName(QWidget parent,
                                               java.lang.String caption)
This is an overloaded function provided for convenience.


getOpenFileName

public static java.lang.String getOpenFileName(QWidget parent)
This is an overloaded function provided for convenience.


getOpenFileName

public static java.lang.String getOpenFileName()
This is an overloaded function provided for convenience.


getOpenFileNames

public static java.util.List getOpenFileNames(QWidget parent,
                                              java.lang.String caption,
                                              java.lang.String dir,
                                              QFileDialog.Filter filter,
                                              QFileDialog.Options options)
This is a convenience static function that will return one or more existing files selected by the user.
    java.util.List<String> files = QFileDialog.getOpenFileNames(
                            this,
                            "Select one or more files to open",
                            "/home",
                            new QFileDialog.Filter("Images (*.png *.xpm *.jpg)"));
This function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. The filter is set to filter so that only those files which match the filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter and filter may be empty strings.

The dialog's caption is set to caption. If caption is not specified then a default caption will be used.

Under Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog. On Mac OS X, the dir argument is ignored, the native dialog always displays the last visited directory.

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.

Note that if you want to iterate over the list of files, you should iterate over a copy. For example:

    java.util.List<String> list = files;
    java.util.ListIterator it = list.listIterator();
    while(it.hasNext()) {
        myProcessing(it.next());
    }

See also:
getOpenFileName(), getSaveFileName(), and getExistingDirectory().


getOpenFileNames

public static java.util.List getOpenFileNames(QWidget parent,
                                              java.lang.String caption,
                                              java.lang.String dir,
                                              QFileDialog.Filter filter,
                                              QFileDialog.Option[] options)
This is a convenience static function that will return one or more existing files selected by the user.
    java.util.List<String> files = QFileDialog.getOpenFileNames(
                            this,
                            "Select one or more files to open",
                            "/home",
                            new QFileDialog.Filter("Images (*.png *.xpm *.jpg)"));
This function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. The filter is set to filter so that only those files which match the filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter and filter may be empty strings.

The dialog's caption is set to caption. If caption is not specified then a default caption will be used.

Under Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog. On Mac OS X, the dir argument is ignored, the native dialog always displays the last visited directory.

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.

Note that if you want to iterate over the list of files, you should iterate over a copy. For example:

    java.util.List<String> list = files;
    java.util.ListIterator it = list.listIterator();
    while(it.hasNext()) {
        myProcessing(it.next());
    }

See also:
getOpenFileName(), getSaveFileName(), and getExistingDirectory().


getOpenFileNames

public static java.util.List getOpenFileNames(QWidget parent,
                                              java.lang.String caption,
                                              java.lang.String dir,
                                              QFileDialog.Filter filter)
This is a convenience static function that will return one or more existing files selected by the user.
    java.util.List<String> files = QFileDialog.getOpenFileNames(
                            this,
                            "Select one or more files to open",
                            "/home",
                            new QFileDialog.Filter("Images (*.png *.xpm *.jpg)"));
This function creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. The filter is set to filter so that only those files which match the filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter and filter may be empty strings.

The dialog's caption is set to caption. If caption is not specified then a default caption will be used.

Under Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog. On Mac OS X, the dir argument is ignored, the native dialog always displays the last visited directory.

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.

Note that if you want to iterate over the list of files, you should iterate over a copy. For example:

    java.util.List<String> list = files;
    java.util.ListIterator it = list.listIterator();
    while(it.hasNext()) {
        myProcessing(it.next());
    }

See also:
getOpenFileName(), getSaveFileName(), and getExistingDirectory().


getOpenFileNames

public static java.util.List getOpenFileNames(QWidget parent,
                                              java.lang.String caption,
                                              java.lang.String dir)
This is an overloaded function provided for convenience.


getOpenFileNames

public static java.util.List getOpenFileNames(QWidget parent,
                                              java.lang.String caption)
This is an overloaded function provided for convenience.


getOpenFileNames

public static java.util.List getOpenFileNames(QWidget parent)
This is an overloaded function provided for convenience.


getOpenFileNames

public static java.util.List getOpenFileNames()
This is an overloaded function provided for convenience.


getSaveFileName

public static java.lang.String getSaveFileName(QWidget parent,
                                               java.lang.String caption,
                                               java.lang.String dir,
                                               QFileDialog.Filter filter,
                                               QFileDialog.Options options)
This is a convenience static function that will return a file name selected by the user. The file does not have to exist.

It creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

    String saveName = QFileDialog.getSaveFileName(this, tr("Save File"),
                               "/home/jana/untitled.png",
                               new QFileDialog.Filter(tr("Images (*.png *.xpm *.jpg)")));
The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. Only files that match the filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.

The default filter can be chosen by setting selectedFilter to the desired value.

The dialog's caption is set to caption. If caption is not specified then a default caption will be used.

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

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar. On Mac OS X, the filter argument is ignored.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

See also:
getOpenFileName(), getOpenFileNames(), and getExistingDirectory().


getSaveFileName

public static java.lang.String getSaveFileName(QWidget parent,
                                               java.lang.String caption,
                                               java.lang.String dir,
                                               QFileDialog.Filter filter,
                                               QFileDialog.Option[] options)
This is a convenience static function that will return a file name selected by the user. The file does not have to exist.

It creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

    String saveName = QFileDialog.getSaveFileName(this, tr("Save File"),
                               "/home/jana/untitled.png",
                               new QFileDialog.Filter(tr("Images (*.png *.xpm *.jpg)")));
The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. Only files that match the filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.

The default filter can be chosen by setting selectedFilter to the desired value.

The dialog's caption is set to caption. If caption is not specified then a default caption will be used.

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

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar. On Mac OS X, the filter argument is ignored.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

See also:
getOpenFileName(), getOpenFileNames(), and getExistingDirectory().


getSaveFileName

public static java.lang.String getSaveFileName(QWidget parent,
                                               java.lang.String caption,
                                               java.lang.String dir,
                                               QFileDialog.Filter filter)
This is a convenience static function that will return a file name selected by the user. The file does not have to exist.

It creates a modal file dialog with the given parent widget. If the parent is not 0, the dialog will be shown centered over the parent widget.

    String saveName = QFileDialog.getSaveFileName(this, tr("Save File"),
                               "/home/jana/untitled.png",
                               new QFileDialog.Filter(tr("Images (*.png *.xpm *.jpg)")));
The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. Only files that match the filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.

The default filter can be chosen by setting selectedFilter to the desired value.

The dialog's caption is set to caption. If caption is not specified then a default caption will be used.

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

Note that on Windows the dialog will spin a blocking modal event loop that will not dispatch any QTimers, and if parent is not 0 then it will position the dialog just under the parent's title bar. On Mac OS X, the filter argument is ignored.

Under Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp, the file dialog will change to /var/tmp after entering /usr/tmp. If options includes DontResolveSymlinks , the file dialog will treat symlinks as regular directories.

See also:
getOpenFileName(), getOpenFileNames(), and getExistingDirectory().


getSaveFileName

public static java.lang.String getSaveFileName(QWidget parent,
                                               java.lang.String caption,
                                               java.lang.String dir)
This is an overloaded function provided for convenience.


getSaveFileName

public static java.lang.String getSaveFileName(QWidget parent,
                                               java.lang.String caption)
This is an overloaded function provided for convenience.


getSaveFileName

public static java.lang.String getSaveFileName(QWidget parent)
This is an overloaded function provided for convenience.


getSaveFileName

public static java.lang.String getSaveFileName()
This is an overloaded function provided for convenience.