|
static QString | getLastVisitedDirectory () |
| Get last visited directory. More...
|
|
static QString | getFileName (QWidget *, const QString &, const QStringList &, const QString &=QString(), const bool=true, const bool=true, SUIT_FileValidator *=0) |
| Show dialog box for the file opening/saving. More...
|
|
static QString | getFileName (QWidget *, const QString &, const QString &, const QString &=QString(), const bool=true, const bool=true, SUIT_FileValidator *=0) |
| Show dialog box for the file opening/saving.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This method can be used to select the file for opening or saving. The behavior is defined by the open parameter. Note, that selection validation depends on the dialog mode used. More...
|
|
static QStringList | getOpenFileNames (QWidget *, const QString &, const QStringList &, const QString &=QString(), const bool=true, SUIT_FileValidator *=0) |
| Show dialog box for the multiple files selection. More...
|
|
static QStringList | getOpenFileNames (QWidget *, const QString &, const QString &, const QString &=QString(), const bool=true, SUIT_FileValidator *=0) |
| Show dialog box for the multiple file opening.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. If initial parameter is not null string it is used as starting directory or file at which dialog box is opened. More...
|
|
static QString | getExistingDirectory (QWidget *, const QString &, const QString &=QString(), const bool=true, SUIT_FileValidator *=0) |
| Show dialog box for the existing directory selection. More...
|
|
static QString | getLastVisitedPath () |
| Get last visited path. More...
|
|
The class SUIT_FileDlg provides a set of static methods which canbe used for file or directories selection:
Examples:
QStringList filters;
filters << "Image files (*.bmp *.gif *.jpg )" << "All files (*)";
QString(),
filters,
"Dump view",
false );
if ( !fileName.isEmpty() ) {
... writing image to the file
}
QStringList filters;
filters << "*.cpp | *.cxx | *.c++" << "*.h | *.hpp | *.hxx";
QStringList fileNames = SUIT_FileDlg::getOpenFileName( desktop(),
QString(),
filters,
QString() );
if ( !fileNames.isEmpty() ) {
... open files
}
The class SUIT_FileDlg can be subclassed to implement custom file dialog boxes. The class provides a set of methods which can be used in subclasses:
- See Also
- SUIT_FileValidator class.
bool SUIT_FileDlg::acceptData |
( |
| ) |
|
|
protectedvirtual |
The validation is done by calling the corresponding methods of the validator. If the validator is not set, this method always returns true
.
This method can be re-implemented in the subclasses to customize the file dialog behavior. Another solution could be implementing own file validator class.
- Returns
true
if user selection (file(s) or directory) is valid
- See Also
- SUIT_FileValidator class, validator(), setValidator()
References addFilter(), SUIT_FileValidator::canOpen(), SUIT_FileValidator::canReadDir(), SUIT_FileValidator::canSave(), SUIT_FileValidator::canWriteDir(), checkPermissions(), hasWildCards(), isOpenDlg(), lineEdit(), selectedFiles(), and validator().
The first widget (usually label) l is placed underneath the "file name" and the "file types" labels. The widget w is placed underneath the file types combobox. The last widget (usually button) b is placed underneath the Cancel push button.
In general, the widgets can be arbitrary. This method is added to support the functionality provided by the Qt series 3.x.
If you don't want to have one of the widgets added, pass 0 in that widget's position. Every time this function is called, a new row of widgets is added to the bottom of the file dialog.
- Parameters
-
l | first widget (e.g. text label) |
w | second widget (e.g. combo box) |
b | third widget (e.g. push button) |
- Returns
true
if widgets have been added successfully
If initial parameter is not null string it is used as starting directory at which dialog box is opened.
The parameter caption is used as dialog box title. If it is is empty, the default title is used.
The parameter showQuickDir specifies if it is necessary to show additional quick directories list controls in the bottom part of the dialog box.
The validation of the user selection is done with help of the file validator (SUIT_FileValidator class). The last parameter validator can be used to pass the custom file validator to the dialog box.
- Parameters
-
parent | parent widget |
initial | initial directory dialog box to be opened on |
caption | dialog box title |
showQuickDir | if true the quick directory list widgets will be shown |
validator | custom file validator |
- Returns
- selected directory name or null string if dialog box is cancelled
- See Also
- getFileName(), getOpenFileNames()
References processPath(), selectedFile(), and setValidator().
This method can be used to select the file for opening or saving. The behavior is defined by the open parameter. Note, that selection validation depends on the dialog mode used.
If initial parameter is not null string it is used as starting directory or file at which dialog box is opened.
The parameter filters defines file filters (wildcards) to be used. If filters list is empty, "All files (*)" is used by default.
The parameter caption is used as dialog box title. If it is is empty, the default title is used.
The parameter showQuickDir specifies if it is necessary to show additional quick directories list controls in the bottom part of the dialog box.
The validation of the user selection is done with help of the file validator (SUIT_FileValidator class). The last parameter validator can be used to pass the custom file validator to the dialog box.
- Parameters
-
parent | parent widget |
initial | initial file (or directory) dialog box to be opened on |
filters | file filters list |
caption | dialog box title |
open | if true dialog box is used for file opening, otherwise - for saving |
showQuickDir | if true the quick directory list widgets will be shown |
validator | custom file validator |
- Returns
- selected file name or null string if dialog box is cancelled
- See Also
- getOpenFileNames(), getExistingDirectory()
References processPath(), selectedFile(), and setValidator().
If initial parameter is not null string it is used as starting directory or file at which dialog box is opened.
The parameter filters defines file filters (wildcards) to be used. This is the list of wildcards, separated by the ";;" symbols. If filters list is empty, "All files (*)" is used by default.
The parameter caption is used as dialog box title. If it is is empty, the default title is used.
The parameter showQuickDir specifies if it is necessary to show additional quick directories list controls in the bottom part of the dialog box.
The validation of the user selection is done with help of the file validator (SUIT_FileValidator class). The last parameter validator can be used to pass the custom file validator to the dialog box.
- Parameters
-
parent | parent widget |
initial | initial file (or directory) dialog box to be opened on |
filters | file filters separated by ";;" |
caption | dialog box title |
open | if true dialog box is used for file opening, otherwise - for saving |
showQuickDir | if true the quick directory list widgets will be shown |
validator | custom file validator |
- Returns
- selected file name or null string if dialog box is cancelled
- See Also
- getOpenFileNames(), getExistingDirectory()
References getFileName(), and validator().
If initial parameter is not null string it is used as starting directory or file at which dialog box is opened.
The parameter filters defines file filters (wildcards) to be used. If filters list is empty, "All files (*)" is used by default.
The parameter caption is used as dialog box title. If it is is empty, the default title is used.
The parameter showQuickDir specifies if it is necessary to show additional quick directories list controls in the bottom part of the dialog box.
The validation of the user selection is done with help of the file validator (SUIT_FileValidator class). The last parameter validator can be used to pass the custom file validator to the dialog box.
- Parameters
-
parent | parent widget |
initial | initial file (or directory) dialog box to be opened on |
filters | file filters list |
caption | dialog box title |
showQuickDir | if true the quick directory list widgets will be shown |
validator | custom file validator |
- Returns
- selected file names or empty list if dialog box is cancelled
- See Also
- getFileName(), getExistingDirectory()
References processPath(), selectedFiles(), and setValidator().
The parameter filters defines file filters (wildcards) to be used. This is the list of wildcards, separated by the ";;" symbols. If filters list is empty, "All files (*)" is used by default.
The parameter caption is used as dialog box title. If it is is empty, the default title is used.
The parameter showQuickDir specifies if it is necessary to show additional quick directories list controls in the bottom part of the dialog box.
The validation of the user selection is done with help of the file validator (SUIT_FileValidator class). The last parameter validator can be used to pass the custom file validator to the dialog box.
- Parameters
-
parent | parent widget |
initial | initial file (or directory) dialog box to be opened on |
filters | file filters separated by ";;" |
caption | dialog box title |
showQuickDir | if true the quick directory list widgets will be shown |
validator | custom file validator |
- Returns
- selected file names or empty list if dialog box is cancelled
- See Also
- getFileName(), getExistingDirectory()
References getOpenFileNames(), and validator().