|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QDialog
com.trolltech.qt.gui.QFileDialog
public class QFileDialog
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.
fileName = QFileDialog::getOpenFileName(this, tr("Open Image"), "/home/jana", 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:
"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(this); dialog.setFileMode(QFileDialog::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 setFilter 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 setFilters. Use selectFilter 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::Detail);
The last important function you will need to use when creating your own file dialog is selectedFiles.
QStringList fileNames; if (dialog.exec()) 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.
Dialogs Example
,
Application ExampleNested Class Summary | |
---|---|
static class |
QFileDialog.AcceptMode
Press link for info on QFileDialog.AcceptMode |
static class |
QFileDialog.DialogLabel
Press link for info on QFileDialog.DialogLabel |
static class |
QFileDialog.FileMode
This enum is used to indicate what the user may select in the file dialog; i.e. what the dialog will return if the user clicks OK. |
static class |
QFileDialog.Filter
|
static class |
QFileDialog.Option
Press link for info on QFileDialog.Option |
static class |
QFileDialog.Options
This QFlag class provides flags for the int enum. |
static class |
QFileDialog.ViewMode
This enum describes the view mode of the file dialog; i.e. what information about each file will be displayed. |
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.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Field Summary | |
---|---|
QSignalEmitter.Signal1<java.lang.String> |
currentChanged
When the current file changes, this signal is emitted with the new file name as the path parameter. |
QSignalEmitter.Signal1<java.lang.String> |
directoryEntered
This signal is emitted when the user enters a directory. |
QSignalEmitter.Signal1<java.util.List<java.lang.String>> |
filesSelected
|
QSignalEmitter.Signal1<java.lang.String> |
filterSelected
This signal is emitted when the user selects a filter. |
Fields inherited from class com.trolltech.qt.gui.QDialog |
---|
accepted, finished, rejected |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QFileDialog()
Equivalent to QFileDialog(0, QString(), QString(), QString()). |
|
QFileDialog(QWidget parent)
Equivalent to QFileDialog(parent, QString(), QString(), QString()). |
|
QFileDialog(QWidget parent,
Qt.WindowFlags f)
Constructs a file dialog with the given parent and widget f. |
|
QFileDialog(QWidget parent,
java.lang.String caption)
Equivalent to QFileDialog(parent, caption, QString(), QString()). |
|
QFileDialog(QWidget parent,
java.lang.String caption,
java.lang.String directory)
Equivalent to QFileDialog(parent, caption, directory, QString()). |
|
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 | |
---|---|
void |
accept()
Hides the modal dialog and sets the result code to Accepted. |
QFileDialog.AcceptMode |
acceptMode()
Returns the accept mode of the dialog. |
protected void |
changeEvent(QEvent e)
This event handler can be reimplemented to handle state changes. |
boolean |
confirmOverwrite()
Returns whether the filedialog should ask before accepting a selected file, when the accept mode is AcceptSave. |
java.lang.String |
defaultSuffix()
Returns suffix added to the filename if no other suffix was specified. |
QDir |
directory()
Returns the directory currently being displayed in the dialog. |
void |
done(int result)
Closes the dialog and sets its result code to arg__1. |
QFileDialog.FileMode |
fileMode()
Returns the file mode of the dialog. |
java.util.List<java.lang.String> |
filters()
Returns the file type filters that are in operation on this file dialog. |
static QFileDialog |
fromNativePointer(QNativePointer nativePointer)
This function returns the QFileDialog instance pointed to by nativePointer |
static java.lang.String |
getExistingDirectory()
Equivalent to getExistingDirectory(0, QString(), QString(), ShowDirsOnly). |
static java.lang.String |
getExistingDirectory(QWidget parent)
Equivalent to getExistingDirectory(parent, QString(), QString(), ShowDirsOnly). |
static java.lang.String |
getExistingDirectory(QWidget parent,
java.lang.String caption)
Equivalent to getExistingDirectory(parent, caption, QString(), ShowDirsOnly). |
static java.lang.String |
getExistingDirectory(QWidget parent,
java.lang.String caption,
java.lang.String dir)
Equivalent to getExistingDirectory(parent, caption, dir, ShowDirsOnly). |
static java.lang.String |
getExistingDirectory(QWidget parent,
java.lang.String caption,
java.lang.String dir,
QFileDialog.Option... options)
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.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 an overloaded function provided for convenience. |
static java.lang.String |
getOpenFileName(QWidget parent,
java.lang.String caption,
java.lang.String dir,
QFileDialog.Filter filter,
QFileDialog.Option... options)
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,
QFileDialog.Options options)
This is a convenience static function that returns an existing file selected by the user. |
static java.util.List<java.lang.String> |
getOpenFileNames()
This is an overloaded function provided for convenience. |
static java.util.List<java.lang.String> |
getOpenFileNames(QWidget parent)
This is an overloaded function provided for convenience. |
static java.util.List<java.lang.String> |
getOpenFileNames(QWidget parent,
java.lang.String caption)
This is an overloaded function provided for convenience. |
static java.util.List<java.lang.String> |
getOpenFileNames(QWidget parent,
java.lang.String caption,
java.lang.String dir)
This is an overloaded function provided for convenience. |
static java.util.List<java.lang.String> |
getOpenFileNames(QWidget parent,
java.lang.String caption,
java.lang.String dir,
QFileDialog.Filter filter)
This is an overloaded function provided for convenience. |
static java.util.List<java.lang.String> |
getOpenFileNames(QWidget parent,
java.lang.String caption,
java.lang.String dir,
QFileDialog.Filter filter,
QFileDialog.Option... options)
This is an overloaded function provided for convenience. |
static java.util.List<java.lang.String> |
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 an overloaded function provided for convenience. |
static java.lang.String |
getSaveFileName(QWidget parent,
java.lang.String caption,
java.lang.String dir,
QFileDialog.Filter filter,
QFileDialog.Option... options)
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,
QFileDialog.Options options)
This is a convenience static function that will return a file name selected by the user. |
java.util.List<java.lang.String> |
history()
returns the browsing history of the filedialog as a list of paths. |
QFileIconProvider |
iconProvider()
returns the icon provider used by the filedialog. |
boolean |
isReadOnly()
Returns Whether the filedialog is readonly.. |
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 |
QAbstractProxyModel |
proxyModel()
Returns the proxy model used by the file dialog. |
boolean |
resolveSymlinks()
Returns whether the filedialog should resolve shortcuts. |
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<java.lang.String> |
selectedFiles()
Returns a list of strings containing the absolute paths of the selected files in the dialog. |
java.lang.String |
selectedFilter()
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)
Sets the current file type filter. |
void |
setAcceptMode(QFileDialog.AcceptMode mode)
Sets the accept mode of the dialog to mode. |
void |
setConfirmOverwrite(boolean enabled)
Sets whether the filedialog should ask before accepting a selected file, when the accept mode is AcceptSave to enabled. |
void |
setDefaultSuffix(java.lang.String suffix)
Sets suffix added to the filename if no other suffix was specified to suffix. |
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)
Sets the file mode of the dialog to mode. |
void |
setFilter(java.lang.String filter)
Sets the filter used in the file dialog to the given filter. |
void |
setFilters(java.util.List<java.lang.String> filters)
Sets the filters used in the file dialog. |
void |
setHistory(java.util.List<java.lang.String> paths)
Sets the browsing history of the filedialog to contain the given paths. |
void |
setIconProvider(QFileIconProvider provider)
set 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)
set the text shown in the filedialog in the specified label |
void |
setProxyModel(QAbstractProxyModel model)
Sets the model for the views to the given model. |
void |
setReadOnly(boolean enabled)
Sets Whether the filedialog is readonly. |
void |
setResolveSymlinks(boolean enabled)
Sets whether the filedialog should resolve shortcuts to enabled. |
void |
setSidebarUrls(java.util.List<QUrl> urls)
Sets the urls that are located in the sidebar |
void |
setViewMode(QFileDialog.ViewMode mode)
Sets the way files and directories are displayed in the dialog to mode. |
java.util.List<QUrl> |
sidebarUrls()
Returns a list of urls that are currently in the sidebar |
QFileDialog.ViewMode |
viewMode()
Returns the way files and directories are displayed in the dialog. |
Methods inherited from class com.trolltech.qt.gui.QDialog |
---|
adjustPosition, closeEvent, contextMenuEvent, eventFilter, exec, isSizeGripEnabled, keyPressEvent, minimumSizeHint, reject, resizeEvent, result, setModal, setResult, setSizeGripEnabled, setVisible, showEvent, sizeHint |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
disconnect, disconnect, signalSender |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1<java.lang.String> currentChanged
When the current file changes, this signal is emitted with the new file name as the path parameter.
public final QSignalEmitter.Signal1<java.lang.String> directoryEntered
This signal is emitted when the user enters a directory.
public final QSignalEmitter.Signal1<java.util.List<java.lang.String>> filesSelected
public final QSignalEmitter.Signal1<java.lang.String> filterSelected
This signal is emitted when the user selects a filter.
Constructor Detail |
---|
public QFileDialog(QWidget parent, Qt.WindowFlags f)
Constructs a file dialog with the given parent and widget f.
public QFileDialog(QWidget parent, java.lang.String caption, java.lang.String directory)
Equivalent to QFileDialog(parent, caption, directory, QString()).
public QFileDialog(QWidget parent, java.lang.String caption)
Equivalent to QFileDialog(parent, caption, QString(), QString()).
public QFileDialog(QWidget parent)
Equivalent to QFileDialog(parent, QString(), QString(), QString()).
public QFileDialog()
Equivalent to QFileDialog(0, QString(), QString(), QString()).
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 |
---|
public final QFileDialog.AcceptMode acceptMode()
Returns the accept mode of the dialog.
The action mode defines whether the dialog is for opening or saving files.
public final boolean confirmOverwrite()
Returns whether the filedialog should ask before accepting a selected file, when the accept mode is AcceptSave.
If this property is set to true and the accept mode is AcceptSave, the filedialog will ask whether the user wants to overwrite the file before accepting the file.
public final java.lang.String defaultSuffix()
Returns 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).
public final QDir directory()
Returns the directory currently being displayed in the dialog.
public final QFileDialog.FileMode fileMode()
Returns 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.
public final java.util.List<java.lang.String> filters()
Returns the file type filters that are in operation on this file dialog.
public final java.util.List<java.lang.String> history()
returns the browsing history of the filedialog as a list of paths.
public final QFileIconProvider iconProvider()
returns the icon provider used by the filedialog.
public final boolean isReadOnly()
Returns Whether the filedialog is readonly..
If this property is set to false, the filedialog will allow renaming, and deleting of files and directories and creating directories.
The default value is false.
public final QAbstractItemDelegate itemDelegate()
returns the item delegate used to render the items in the views in the filedialog
public final java.lang.String labelText(QFileDialog.DialogLabel label)
returns the text shown in the filedialog in the specified label
public final QAbstractProxyModel proxyModel()
Returns the proxy model used by the file dialog. By default no proxy is set.
public final boolean resolveSymlinks()
Returns whether the filedialog should resolve shortcuts.
If this property is set to true, the file dialog will resolve shortcuts.
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
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.
public final void selectFile(java.lang.String filename)
Selects the given filename in the file dialog.
public final void selectFilter(java.lang.String filter)
Sets the current file type filter. Multiple filters can be passed in filter by separating them with semicolons or spaces.
public final java.util.List<java.lang.String> 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, selectedFiles is an empty string list.
public final java.lang.String selectedFilter()
Returns the filter that the user selected in the file dialog.
public final void setAcceptMode(QFileDialog.AcceptMode mode)
Sets the accept mode of the dialog to mode.
The action mode defines whether the dialog is for opening or saving files.
public final void setConfirmOverwrite(boolean enabled)
Sets whether the filedialog should ask before accepting a selected file, when the accept mode is AcceptSave to enabled.
If this property is set to true and the accept mode is AcceptSave, the filedialog will ask whether the user wants to overwrite the file before accepting the file.
public final void setDefaultSuffix(java.lang.String suffix)
Sets suffix added to the filename if no other suffix was specified to suffix.
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).
public final void setDirectory(java.lang.String directory)
Sets the file dialog's current directory.
public final void setDirectory(QDir directory)
public final void setFileMode(QFileDialog.FileMode mode)
Sets the file mode of the dialog to mode.
The file mode defines the number and type of items that the user is expected to select in the dialog.
public final void setFilter(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 semicolons, 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++");
public final void setFilters(java.util.List<java.lang.String> filters)
Sets the filters used in the file dialog.
QStringList filters; filters << "Image files (*.png *.xpm *.jpg)" << "Text files (*.txt)" << "Any files (*)"; QFileDialog dialog(this); dialog.setFilters(filters); dialog.exec();
public final void setHistory(java.util.List<java.lang.String> paths)
Sets the browsing history of the filedialog to contain the given paths.
public final void setIconProvider(QFileIconProvider provider)
set the icon provider used by the filedialog to the specified provider
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.
public final void setLabelText(QFileDialog.DialogLabel label, java.lang.String text)
set the text shown in the filedialog in the specified label
public final void setProxyModel(QAbstractProxyModel model)
Sets the model for the views to the given model. 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 model.
public final void setReadOnly(boolean enabled)
Sets Whether the filedialog is readonly. to enabled.
If this property is set to false, the filedialog will allow renaming, and deleting of files and directories and creating directories.
The default value is false.
public final void setResolveSymlinks(boolean enabled)
Sets whether the filedialog should resolve shortcuts to enabled.
If this property is set to true, the file dialog will resolve shortcuts.
public final void setSidebarUrls(java.util.List<QUrl> urls)
Sets the urls that are located in the sidebar
public final void setViewMode(QFileDialog.ViewMode mode)
Sets the way files and directories are displayed in the dialog to mode.
By default, the Detail mode is used to display information about files and directories.
public final java.util.List<QUrl> sidebarUrls()
Returns a list of urls that are currently in the sidebar
public final QFileDialog.ViewMode viewMode()
Returns the way files and directories are displayed in the dialog.
By default, the Detail mode is used to display information about files and directories.
public void accept()
Hides the modal dialog and sets the result code to Accepted.
accept
in class QDialog
protected void changeEvent(QEvent e)
This event handler can be reimplemented to handle state changes.
The state being changed in this event can be retrieved through event arg__1.
Change events include: QEvent::ToolBarChange, QEvent::ActivationChange, QEvent::EnabledChange, QEvent::FontChange, QEvent::StyleChange, QEvent::PaletteChange, QEvent::WindowTitleChange, QEvent::IconTextChange, QEvent::ModifiedChange, QEvent::MouseTrackingChange, QEvent::ParentChange, QEvent::WindowStateChange, QEvent::LanguageChange, QEvent::LocaleChange, QEvent::LayoutDirectionChange.
changeEvent
in class QWidget
public void done(int result)
Closes the dialog and sets its result code to arg__1. If this dialog is shown with exec, done causes the local event loop to finish, and exec to return arg__1.
As with QWidget::close(), done deletes the dialog if the Qt::WA_DeleteOnClose flag is set. If the dialog is the application's main widget, the application terminates. If the dialog is the last window closed, the QApplication::lastWindowClosed() signal is emitted.
done
in class QDialog
public static java.lang.String getExistingDirectory(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Option... options)
This is a convenience static function that will return an existing directory selected by the user.
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home", QFileDialog::ShowDirsOnly | QFileDialog::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.
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.
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.
public static java.lang.String getExistingDirectory(QWidget parent, java.lang.String caption, java.lang.String dir)
Equivalent to getExistingDirectory(parent, caption, dir, ShowDirsOnly).
public static java.lang.String getExistingDirectory(QWidget parent, java.lang.String caption)
Equivalent to getExistingDirectory(parent, caption, QString(), ShowDirsOnly).
public static java.lang.String getExistingDirectory(QWidget parent)
Equivalent to getExistingDirectory(parent, QString(), QString(), ShowDirsOnly).
public static java.lang.String getExistingDirectory()
Equivalent to getExistingDirectory(0, QString(), QString(), ShowDirsOnly).
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.
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home", QFileDialog::ShowDirsOnly | QFileDialog::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.
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.
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.
public static QFileDialog fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.public static java.lang.String getOpenFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Options options)
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 parameter dir can be an empty string. 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. 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 \c{/usr/tmp} is a symlink to \c{/var/tmp}, the file dialog will change to \c{/var/tmp} after entering \c{/usr/tmp}. If options includes DontResolveSymlinks, the file dialog will treat symlinks as regular directories.
public static java.lang.String getOpenFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Option... options)
public static java.lang.String getOpenFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter)
public static java.lang.String getOpenFileName(QWidget parent, java.lang.String caption, java.lang.String dir)
public static java.lang.String getOpenFileName(QWidget parent, java.lang.String caption)
public static java.lang.String getOpenFileName(QWidget parent)
public static java.lang.String getOpenFileName()
public static java.util.List<java.lang.String> getOpenFileNames(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Options options)
This function creates a modal file dialog with the given parent widget. If the parent is not null, 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 parameter may be an empty string.
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 null 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:
public static java.util.List<java.lang.String> getOpenFileNames(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Option... options)
public static java.util.List<java.lang.String> getOpenFileNames(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter)
public static java.util.List<java.lang.String> getOpenFileNames(QWidget parent, java.lang.String caption, java.lang.String dir)
public static java.util.List<java.lang.String> getOpenFileNames(QWidget parent, java.lang.String caption)
public static java.util.List<java.lang.String> getOpenFileNames(QWidget parent)
public static java.util.List<java.lang.String> getOpenFileNames()
public static java.lang.String getSaveFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Options options)
It creates a modal file dialog with the given parent widget. If the parent is not null, 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 filter are shown. The parameter dir may be an empty string. 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. 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 \c{/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.
public static java.lang.String getSaveFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter, QFileDialog.Option... options)
public static java.lang.String getSaveFileName(QWidget parent, java.lang.String caption, java.lang.String dir, QFileDialog.Filter filter)
public static java.lang.String getSaveFileName(QWidget parent, java.lang.String caption, java.lang.String dir)
public static java.lang.String getSaveFileName(QWidget parent, java.lang.String caption)
public static java.lang.String getSaveFileName(QWidget parent)
public static java.lang.String getSaveFileName()
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |