Eneboo - Documentación para desarrolladores
|
The QFileDialog class provides dialogs that allow users to select files or directories.. Más...
#include <qfiledialog.h>
Tipos públicos | |
enum | Mode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly, AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly } |
enum | ViewMode { Detail, List, Detail, List } |
enum | PreviewMode { NoPreview, Contents, Info, NoPreview, Contents, Info } |
enum | Mode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly, AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly } |
enum | ViewMode { Detail, List, Detail, List } |
enum | PreviewMode { NoPreview, Contents, Info, NoPreview, Contents, Info } |
Slots públicos | |
void | done (int) |
void | setDir (const QString &) |
void | setUrl (const QUrlOperator &url) |
void | setFilter (const QString &) |
void | setFilters (const QString &) |
void | setFilters (const char **) |
void | setFilters (const QStringList &) |
void | done (int) |
void | setDir (const QString &) |
void | setUrl (const QUrlOperator &url) |
void | setFilter (const QString &) |
void | setFilters (const QString &) |
void | setFilters (const char **) |
void | setFilters (const QStringList &) |
Señales | |
void | fileHighlighted (const QString &) |
void | fileSelected (const QString &) |
void | filesSelected (const QStringList &) |
void | dirEntered (const QString &) |
void | filterSelected (const QString &) |
void | fileHighlighted (const QString &) |
void | fileSelected (const QString &) |
void | filesSelected (const QStringList &) |
void | dirEntered (const QString &) |
void | filterSelected (const QString &) |
Métodos públicos | |
QFileDialog (const QString &dirName, const QString &filter=QString::null, QWidget *parent=0, const char *name=0, bool modal=FALSE) | |
QFileDialog (QWidget *parent=0, const char *name=0, bool modal=FALSE) | |
~QFileDialog () | |
QString | selectedFile () const |
QString | selectedFilter () const |
virtual void | setSelectedFilter (const QString &) |
virtual void | setSelectedFilter (int) |
void | setSelection (const QString &) |
void | selectAll (bool b) |
QStringList | selectedFiles () const |
QString | dirPath () const |
void | setDir (const QDir &) |
const QDir * | dir () const |
void | setShowHiddenFiles (bool s) |
bool | showHiddenFiles () const |
void | rereadDir () |
void | resortDir () |
void | setMode (Mode) |
Mode | mode () const |
void | setViewMode (ViewMode m) |
ViewMode | viewMode () const |
void | setPreviewMode (PreviewMode m) |
PreviewMode | previewMode () const |
bool | eventFilter (QObject *, QEvent *) |
bool | isInfoPreviewEnabled () const |
bool | isContentsPreviewEnabled () const |
void | setInfoPreviewEnabled (bool) |
void | setContentsPreviewEnabled (bool) |
void | setInfoPreview (QWidget *w, QFilePreview *preview) |
void | setContentsPreview (QWidget *w, QFilePreview *preview) |
QUrl | url () const |
void | addFilter (const QString &filter) |
QFileDialog (const QString &dirName, const QString &filter=QString::null, QWidget *parent=0, const char *name=0, bool modal=FALSE) | |
QFileDialog (QWidget *parent=0, const char *name=0, bool modal=FALSE) | |
~QFileDialog () | |
QString | selectedFile () const |
QString | selectedFilter () const |
virtual void | setSelectedFilter (const QString &) |
virtual void | setSelectedFilter (int) |
void | setSelection (const QString &) |
void | selectAll (bool b) |
QStringList | selectedFiles () const |
QString | dirPath () const |
void | setDir (const QDir &) |
const QDir * | dir () const |
void | setShowHiddenFiles (bool s) |
bool | showHiddenFiles () const |
void | rereadDir () |
void | resortDir () |
void | setMode (Mode) |
Mode | mode () const |
void | setViewMode (ViewMode m) |
ViewMode | viewMode () const |
void | setPreviewMode (PreviewMode m) |
PreviewMode | previewMode () const |
bool | eventFilter (QObject *, QEvent *) |
bool | isInfoPreviewEnabled () const |
bool | isContentsPreviewEnabled () const |
void | setInfoPreviewEnabled (bool) |
void | setContentsPreviewEnabled (bool) |
void | setInfoPreview (QWidget *w, QFilePreview *preview) |
void | setContentsPreview (QWidget *w, QFilePreview *preview) |
QUrl | url () const |
void | addFilter (const QString &filter) |
Métodos públicos estáticos | |
static QString | getOpenFileName (const QString &initially=QString::null, const QString &filter=QString::null, QWidget *parent=0, const char *name=0, const QString &caption=QString::null, QString *selectedFilter=0, bool resolveSymlinks=TRUE) |
static QString | getSaveFileName (const QString &initially=QString::null, const QString &filter=QString::null, QWidget *parent=0, const char *name=0, const QString &caption=QString::null, QString *selectedFilter=0, bool resolveSymlinks=TRUE) |
static QString | getExistingDirectory (const QString &dir=QString::null, QWidget *parent=0, const char *name=0, const QString &caption=QString::null, bool dirOnly=TRUE, bool resolveSymlinks=TRUE) |
static QStringList | getOpenFileNames (const QString &filter=QString::null, const QString &dir=QString::null, QWidget *parent=0, const char *name=0, const QString &caption=QString::null, QString *selectedFilter=0, bool resolveSymlinks=TRUE) |
static void | setIconProvider (QFileIconProvider *) |
static QFileIconProvider * | iconProvider () |
static QString | getOpenFileName (const QString &initially=QString::null, const QString &filter=QString::null, QWidget *parent=0, const char *name=0, const QString &caption=QString::null, QString *selectedFilter=0, bool resolveSymlinks=TRUE) |
static QString | getSaveFileName (const QString &initially=QString::null, const QString &filter=QString::null, QWidget *parent=0, const char *name=0, const QString &caption=QString::null, QString *selectedFilter=0, bool resolveSymlinks=TRUE) |
static QString | getExistingDirectory (const QString &dir=QString::null, QWidget *parent=0, const char *name=0, const QString &caption=QString::null, bool dirOnly=TRUE, bool resolveSymlinks=TRUE) |
static QStringList | getOpenFileNames (const QString &filter=QString::null, const QString &dir=QString::null, QWidget *parent=0, const char *name=0, const QString &caption=QString::null, QString *selectedFilter=0, bool resolveSymlinks=TRUE) |
static void | setIconProvider (QFileIconProvider *) |
static QFileIconProvider * | iconProvider () |
Métodos protegidos | |
void | resizeEvent (QResizeEvent *) |
void | keyPressEvent (QKeyEvent *) |
void | addWidgets (QLabel *, QWidget *, QPushButton *) |
void | addToolButton (QButton *b, bool separator=FALSE) |
void | addLeftWidget (QWidget *w) |
void | addRightWidget (QWidget *w) |
void | resizeEvent (QResizeEvent *) |
void | keyPressEvent (QKeyEvent *) |
void | addWidgets (QLabel *, QWidget *, QPushButton *) |
void | addToolButton (QButton *b, bool separator=FALSE) |
void | addLeftWidget (QWidget *w) |
void | addRightWidget (QWidget *w) |
Propiedades | |
QString | selectedFile |
the name of the selected file | |
QString | selectedFilter |
the filter which the user has selected in the file dialog | |
QStringList | selectedFiles |
the list of selected files | |
QString | dirPath |
the file dialog's working directory | |
bool | showHiddenFiles |
whether hidden files are shown in the file dialog | |
Mode | mode |
the file dialog's mode | |
ViewMode | viewMode |
the file dialog's view mode | |
PreviewMode | previewMode |
the preview mode for the file dialog | |
bool | infoPreview |
whether the file dialog can provide preview information about the currently selected file | |
bool | contentsPreview |
whether the file dialog can provide a contents preview of the currently selected file | |
Amigas | |
class | QFileDialogQFileListView |
class | QFileListBox |
The QFileDialog class provides dialogs that allow users to select files or directories.
.
The QFileDialog class enables a user to traverse their 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.
QString s = QFileDialog::getOpenFileName( "/home", "Images (*.png *.xpm *.jpg)", this, "open file dialog", "Choose a file" );
In the above example, a modal QFileDialog is created using a static function. The startup directory is set to "/home". The file filter is set to "Images (*.png *.xpm *.jpg)". The parent of the file dialog is set to this and it is given the identification name - "open file dialog". The caption at the top of file dialog is set to "Choose a file". If you want to use multiple filters, separate each one with two semi-colons, e.g.
"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
You can create your own QFileDialog without using the static functions. By calling setMode(), you can set what can be returned by the QFileDialog.
QFileDialog* fd = new QFileDialog( this, "file dialog", TRUE ); fd->setMode( 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 "File 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::Mode enum for the complete list of modes.)
You can retrieve the dialog's mode with mode(). Use setFilter() to set the dialog's file filter, e.g.
fd->setFilter( "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() and add additional filters with addFilter(). Use setSelectedFilter() to select one of the filters you've given as the file dialog's default filter. Whenever the user changes the filter the filterSelected() signal is emitted.
The file dialog has two view modes, QFileDialog::List which simply lists file and directory names and QFileDialog::Detail which displays additional information alongside each name, e.g. file size, modification date, etc. Set the mode with setViewMode().
fd->setViewMode( QFileDialog::Detail );
The last important function you will need to use when creating your own file dialog is selectedFile().
QString fileName; if ( fd->exec() == QDialog::Accepted ) fileName = fd->selectedFile();
In the above example, a modal file dialog is created and shown. If the user clicked OK, then the file they selected is put in fileName
.
If you are using the ExistingFiles
mode then you will need to use selectedFiles() which will return the selected files in a QStringList.
The dialog's working directory can be set with setDir(). The display of hidden files is controlled with setShowHiddenFiles(). The dialog can be forced to re-read the directory with rereadDir() and re-sort the directory with resortDir(). All the files in the current directory can be selected with selectAll().
enum QFileDialog::Mode |
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.
AnyFile The name of a file, whether it exists or not. ExistingFile The name of a single existing file. Directory The name of a directory. Both files and directories are displayed. DirectoryOnly The name of a directory. The file dialog will only display directories. ExistingFiles The names of zero or more existing files.
See setMode().
enum QFileDialog::Mode |
This enum describes the preview mode of the file dialog.
NoPreview No preview is shown at all. Contents Show a preview of the contents of the current file using the contents preview widget. Info Show information about the current file using the info preview widget.
See setPreviewMode(), setContentsPreview() and setInfoPreview().
This enum describes the view mode of the file dialog, i.e. what information about each file will be displayed.
List Display file and directory names with icons. Detail Display file and directory names with icons plus additional information, such as file size and modification date.
See setViewMode().
QFileDialog::QFileDialog | ( | const QString & | dirName, |
const QString & | filter = QString::null , |
||
QWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
bool | modal = FALSE |
||
) |
Constructs a file dialog called name with the parent, parent. If modal is TRUE then the file dialog is modal; otherwise it is modeless.
If dirName is specified then it will be used as the dialog's working directory, i.e. it will be the directory that is shown when the dialog appears. If filter is specified it will be used as the dialog's file filter.
Constructs a file dialog called name, with the parent, parent. If modal is TRUE then the file dialog is modal; otherwise it is modeless.
QFileDialog::~QFileDialog | ( | ) |
Destroys the file dialog.
QFileDialog::QFileDialog | ( | const QString & | dirName, |
const QString & | filter = QString::null , |
||
QWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
bool | modal = FALSE |
||
) |
QFileDialog::~QFileDialog | ( | ) |
void QFileDialog::addFilter | ( | const QString & | filter | ) |
Adds the filter filter to the list of filters and makes it the current filter.
QFileDialog* fd = new QFileDialog( this ); fd->addFilter( "Images (*.png *.jpg *.xpm)" ); fd->show();
In the above example, a file dialog is created, and the file filter "Images (*.png *.jpg *.xpm)" is added and is set as the current filter. The original filter, "All Files (*)", is still available.
void QFileDialog::addFilter | ( | const QString & | filter | ) |
void QFileDialog::addLeftWidget | ( | QWidget * | w | ) | [protected] |
Adds the widget w to the left-hand side of the file dialog.
void QFileDialog::addLeftWidget | ( | QWidget * | w | ) | [protected] |
void QFileDialog::addRightWidget | ( | QWidget * | w | ) | [protected] |
Adds the widget w to the right-hand side of the file dialog.
void QFileDialog::addRightWidget | ( | QWidget * | w | ) | [protected] |
Adds the tool button b to the row of tool buttons at the top of the file dialog. The button is appended to the right of this row. If separator is TRUE, a small space is inserted between the last button of the row and the new button b.
void QFileDialog::addWidgets | ( | QLabel * | l, |
QWidget * | w, | ||
QPushButton * | b | ||
) | [protected] |
Adds the specified widgets to the bottom of the file dialog. The label l is placed underneath the "file name" and the "file types" labels. The widget w is placed underneath the file types combobox. The button b is placed underneath the Cancel pushbutton.
MyFileDialog::MyFileDialog( QWidget* parent, const char* name ) : QFileDialog( parent, name ) { QLabel* label = new QLabel( "Added widgets", this ); QLineEdit* lineedit = new QLineEdit( this ); QPushButton* pushbutton = new QPushButton( this ); addWidgets( label, lineedit, pushbutton ); }
If you don't want to have one of the widgets added, pass 0 in that widget's position.
Every time you call this function, a new row of widgets will be added to the bottom of the file dialog.
void QFileDialog::addWidgets | ( | QLabel * | , |
QWidget * | , | ||
QPushButton * | |||
) | [protected] |
const QDir* QFileDialog::dir | ( | ) | const |
const QDir * QFileDialog::dir | ( | ) | const |
void QFileDialog::dirEntered | ( | const QString & | t0 | ) | [signal] |
This signal is emitted when the user enters a directory.
void QFileDialog::dirEntered | ( | const QString & | ) | [signal] |
QString QFileDialog::dirPath | ( | ) | const |
QString QFileDialog::dirPath | ( | ) | const |
void QFileDialog::done | ( | int | r | ) | [virtual, slot] |
Closes the dialog and sets its result code to r. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return r.
As with QWidget::close(), done() deletes the dialog if the WDestructiveClose
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.
Reimplementado de QDialog.
void QFileDialog::fileHighlighted | ( | const QString & | t0 | ) | [signal] |
This signal is emitted when the user highlights a file, i.e. makes it the current file.
void QFileDialog::fileHighlighted | ( | const QString & | ) | [signal] |
void QFileDialog::fileSelected | ( | const QString & | t0 | ) | [signal] |
This signal is emitted when the user selects a file.
void QFileDialog::fileSelected | ( | const QString & | ) | [signal] |
void QFileDialog::filesSelected | ( | const QStringList & | t0 | ) | [signal] |
This signal is emitted when the user selects one or more files in ExistingFiles mode.
void QFileDialog::filesSelected | ( | const QStringList & | ) | [signal] |
void QFileDialog::filterSelected | ( | const QString & | t0 | ) | [signal] |
This signal is emitted when the user selects a filter.
void QFileDialog::filterSelected | ( | const QString & | ) | [signal] |
QString QFileDialog::getExistingDirectory | ( | const QString & | dir = QString::null , |
QWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const QString & | caption = QString::null , |
||
bool | dirOnly = TRUE , |
||
bool | resolveSymlinks = TRUE |
||
) | [static] |
This is a convenience static function that will return an existing directory selected by the user.
QString s = QFileDialog::getExistingDirectory( "/home", this, "get existing directory", "Choose a directory", TRUE );
This function creates a modal file dialog called name, with parent, parent. If parent is not 0, the dialog will be shown centered over the parent.
The dialog's working directory is set to dir, and the caption is set to caption. Either of these may be QString::null in which case the current directory and a default caption will be used respectively.
Note on Windows that if dir is QString::null then the dialog's working directory will be set to the user's My Documents directory.
If dirOnly is TRUE, then only directories will be shown in the file dialog; otherwise both directories and files will be shown.
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 resolveSymlinks is FALSE, the file dialog will treat symlinks as regular directories.
Under Windows and Mac OS X, this static function will use the native file dialog and not a QFileDialog, unless the style of the application is set to something other than the native style. (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 titlebar).
static QString QFileDialog::getExistingDirectory | ( | const QString & | dir = QString::null , |
QWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const QString & | caption = QString::null , |
||
bool | dirOnly = TRUE , |
||
bool | resolveSymlinks = TRUE |
||
) | [static] |
static QString QFileDialog::getOpenFileName | ( | const QString & | initially = QString::null , |
const QString & | filter = QString::null , |
||
QWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const QString & | caption = QString::null , |
||
QString * | selectedFilter = 0 , |
||
bool | resolveSymlinks = TRUE |
||
) | [static] |
QString QFileDialog::getOpenFileName | ( | const QString & | startWith = QString::null , |
const QString & | filter = QString::null , |
||
QWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const QString & | caption = QString::null , |
||
QString * | selectedFilter = 0 , |
||
bool | resolveSymlinks = TRUE |
||
) | [static] |
This is a convenience static function that returns an existing file selected by the user. If the user pressed Cancel, it returns a null string.
QString s = QFileDialog::getOpenFileName( "/home", "Images (*.png *.xpm *.jpg)", this, "open file dialog", "Choose a file to open" );
The function creates a modal file dialog called name, with parent, parent. If a parent is not 0, the dialog will be shown centered over the parent.
The file dialog's working directory will be set to startWith. If startWith 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 startWith, selectedFilter and filter may be QString::null.
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, unless the style of the application is set to something other than the native style (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 titlebar).
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 resolveSymlinks is FALSE, the file dialog will treat symlinks as regular directories.
QStringList QFileDialog::getOpenFileNames | ( | const QString & | filter = QString::null , |
const QString & | dir = QString::null , |
||
QWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const QString & | caption = QString::null , |
||
QString * | selectedFilter = 0 , |
||
bool | resolveSymlinks = TRUE |
||
) | [static] |
This is a convenience static function that will return one or more existing files selected by the user.
QStringList files = QFileDialog::getOpenFileNames( "Images (*.png *.xpm *.jpg)", "/home", this, "open files dialog", "Select one or more files to open" );
This function creates a modal file dialog called name, with parent parent. If parent is not 0, the dialog will be shown centered over the parent.
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 QString::null.
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, unless the style of the application is set to something other than the native style. (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 titlebar).
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 resolveSymlinks is FALSE, the file dialog will treat symlinks as regular directories.
Note that if you want to iterate over the list of files, you should iterate over a copy, e.g.
QStringList list = files; QStringList::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; }
static QStringList QFileDialog::getOpenFileNames | ( | const QString & | filter = QString::null , |
const QString & | dir = QString::null , |
||
QWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const QString & | caption = QString::null , |
||
QString * | selectedFilter = 0 , |
||
bool | resolveSymlinks = TRUE |
||
) | [static] |
QString QFileDialog::getSaveFileName | ( | const QString & | startWith = QString::null , |
const QString & | filter = QString::null , |
||
QWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const QString & | caption = QString::null , |
||
QString * | selectedFilter = 0 , |
||
bool | resolveSymlinks = TRUE |
||
) | [static] |
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 called name, with parent, parent. If a parent is not 0, the dialog will be shown centered over the parent.
QString s = QFileDialog::getSaveFileName( "/home", "Images (*.png *.xpm *.jpg)", this, "save file dialog", "Choose a filename to save under" );
The file dialog's working directory will be set to startWith. If startWith 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 startWith, selectedFilter and filter may be QString::null.
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, unless the style of the application is set to something other than the native style. (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 titlebar.
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 resolveSymlinks is FALSE, the file dialog will treat symlinks as regular directories.
static QString QFileDialog::getSaveFileName | ( | const QString & | initially = QString::null , |
const QString & | filter = QString::null , |
||
QWidget * | parent = 0 , |
||
const char * | name = 0 , |
||
const QString & | caption = QString::null , |
||
QString * | selectedFilter = 0 , |
||
bool | resolveSymlinks = TRUE |
||
) | [static] |
QFileIconProvider * QFileDialog::iconProvider | ( | ) | [static] |
Returns a pointer to the icon provider currently set on the file dialog. By default there is no icon provider, and this function returns 0.
static QFileIconProvider* QFileDialog::iconProvider | ( | ) | [static] |
bool QFileDialog::isContentsPreviewEnabled | ( | ) | const |
bool QFileDialog::isContentsPreviewEnabled | ( | ) | const |
bool QFileDialog::isInfoPreviewEnabled | ( | ) | const |
bool QFileDialog::isInfoPreviewEnabled | ( | ) | const |
Mode QFileDialog::mode | ( | ) | const |
Mode QFileDialog::mode | ( | ) | const |
PreviewMode QFileDialog::previewMode | ( | ) | const |
PreviewMode QFileDialog::previewMode | ( | ) | const |
void QFileDialog::rereadDir | ( | ) |
void QFileDialog::rereadDir | ( | ) |
Rereads the current directory shown in the file dialog.
The only time you will need to call this function is if the contents of the directory change and you wish to refresh the file dialog to reflect the change.
void QFileDialog::resizeEvent | ( | QResizeEvent * | e | ) | [protected, virtual] |
Reimplementado de QDialog.
void QFileDialog::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
Reimplementado de QDialog.
void QFileDialog::resortDir | ( | ) |
void QFileDialog::resortDir | ( | ) |
Re-sorts the displayed directory.
void QFileDialog::selectAll | ( | bool | b | ) |
void QFileDialog::selectAll | ( | bool | b | ) |
If b is TRUE then all the files in the current directory are selected; otherwise, they are deselected.
QString QFileDialog::selectedFile | ( | ) | const |
QString QFileDialog::selectedFile | ( | ) | const |
QStringList QFileDialog::selectedFiles | ( | ) | const |
QStringList QFileDialog::selectedFiles | ( | ) | const |
QString QFileDialog::selectedFilter | ( | ) | const |
QString QFileDialog::selectedFilter | ( | ) | const |
void QFileDialog::setContentsPreview | ( | QWidget * | w, |
QFilePreview * | preview | ||
) |
Sets the widget to be used for displaying the contents of the file to the widget w and a preview of those contents to the QFilePreview preview.
Normally you would create a preview widget that derives from both QWidget and QFilePreview, so you should pass the same widget twice. If you don't, you must remember to delete the preview object in order to avoid memory leaks.
class Preview : public QLabel, public QFilePreview { public: Preview( QWidget *parent=0 ) : QLabel( parent ) {} void previewUrl( const QUrl &u ) { QString path = u.path(); QPixmap pix( path ); if ( pix.isNull() ) setText( "This is not a pixmap" ); else setPixmap( pix ); } }; //... int main( int argc, char** argv ) { Preview* p = new Preview; QFileDialog* fd = new QFileDialog( this ); fd->setContentsPreviewEnabled( TRUE ); fd->setContentsPreview( p, p ); fd->setPreviewMode( QFileDialog::Contents ); fd->show(); }
void QFileDialog::setContentsPreview | ( | QWidget * | w, |
QFilePreview * | preview | ||
) |
void QFileDialog::setContentsPreviewEnabled | ( | bool | contents | ) |
void QFileDialog::setContentsPreviewEnabled | ( | bool | ) |
void QFileDialog::setDir | ( | const QDir & | ) |
void QFileDialog::setDir | ( | const QString & | pathstr | ) | [slot] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the file dialog's working directory to pathstr.
void QFileDialog::setDir | ( | const QString & | ) | [slot] |
void QFileDialog::setDir | ( | const QDir & | dir | ) |
Sets the file dialog's working directory to dir.
void QFileDialog::setFilter | ( | const QString & | newFilter | ) | [slot] |
Sets the filter used in the file dialog to newFilter.
If newFilter contains a pair of parentheses containing one or more of anything*something separated by spaces or by semi-colons then only the text contained in the parentheses is used as the filter. This means that these calls are all equivalent:
fd->setFilter( "All C++ files (*.cpp *.cc *.C *.cxx *.c++)" ); fd->setFilter( "*.cpp *.cc *.C *.cxx *.c++" ); fd->setFilter( "All C++ files (*.cpp;*.cc;*.C;*.cxx;*.c++)" ); fd->setFilter( "*.cpp;*.cc;*.C;*.cxx;*.c++" );
void QFileDialog::setFilter | ( | const QString & | ) | [slot] |
void QFileDialog::setFilters | ( | const QString & | ) | [slot] |
void QFileDialog::setFilters | ( | const QString & | filters | ) | [slot] |
Sets the filters used in the file dialog to filters. Each group of filters must be separated by {;;} (two semi-colons).
QString types("Image files (*.png *.xpm *.jpg);;" "Text files (*.txt);;" "Any files (*)"); QFileDialog fd = new QFileDialog( this ); fd->setFilters( types ); fd->show();
void QFileDialog::setFilters | ( | const QStringList & | types | ) | [slot] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
void QFileDialog::setFilters | ( | const char ** | ) | [slot] |
void QFileDialog::setFilters | ( | const char ** | types | ) | [slot] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. types must be a null-terminated list of strings.
void QFileDialog::setFilters | ( | const QStringList & | ) | [slot] |
void QFileDialog::setIconProvider | ( | QFileIconProvider * | provider | ) | [static] |
Sets the QFileIconProvider used by the file dialog to provider.
The default is that there is no QFileIconProvider and QFileDialog just draws a folder icon next to each directory and nothing next to files.
static void QFileDialog::setIconProvider | ( | QFileIconProvider * | ) | [static] |
void QFileDialog::setInfoPreview | ( | QWidget * | w, |
QFilePreview * | preview | ||
) |
Sets the widget to be used for displaying information about the file to the widget w and a preview of that information to the QFilePreview preview.
Normally you would create a preview widget that derives from both QWidget and QFilePreview, so you should pass the same widget twice. If you don't, you must remember to delete the preview object in order to avoid memory leaks.
class Preview : public QLabel, public QFilePreview { public: Preview( QWidget *parent=0 ) : QLabel( parent ) {} void previewUrl( const QUrl &u ) { QString path = u.path(); QPixmap pix( path ); if ( pix.isNull() ) setText( "This is not a pixmap" ); else setText( "This is a pixmap" ); } }; //... int main( int argc, char** argv ) { Preview* p = new Preview; QFileDialog* fd = new QFileDialog( this ); fd->setInfoPreviewEnabled( TRUE ); fd->setInfoPreview( p, p ); fd->setPreviewMode( QFileDialog::Info ); fd->show(); }
void QFileDialog::setInfoPreview | ( | QWidget * | w, |
QFilePreview * | preview | ||
) |
void QFileDialog::setInfoPreviewEnabled | ( | bool | info | ) |
void QFileDialog::setInfoPreviewEnabled | ( | bool | ) |
void QFileDialog::setMode | ( | Mode | ) |
void QFileDialog::setMode | ( | Mode | newMode | ) |
void QFileDialog::setPreviewMode | ( | PreviewMode | m | ) |
void QFileDialog::setPreviewMode | ( | PreviewMode | m | ) |
void QFileDialog::setSelectedFilter | ( | int | n | ) | [virtual] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the current filter selected in the file dialog to the {n}-th filter in the filter list.
virtual void QFileDialog::setSelectedFilter | ( | const QString & | ) | [virtual] |
virtual void QFileDialog::setSelectedFilter | ( | int | ) | [virtual] |
void QFileDialog::setSelectedFilter | ( | const QString & | mask | ) | [virtual] |
Sets the current filter selected in the file dialog to the first one that contains the text mask.
void QFileDialog::setSelection | ( | const QString & | filename | ) |
Sets the default selection to filename. If filename is absolute, setDir() is also called to set the file dialog's working directory to the filename's directory.
Only for external use. Not useful inside QFileDialog.
void QFileDialog::setSelection | ( | const QString & | ) |
void QFileDialog::setShowHiddenFiles | ( | bool | s | ) |
void QFileDialog::setShowHiddenFiles | ( | bool | s | ) |
void QFileDialog::setUrl | ( | const QUrlOperator & | url | ) | [slot] |
void QFileDialog::setUrl | ( | const QUrlOperator & | url | ) | [slot] |
Sets the file dialog's working directory to the directory specified at url.
void QFileDialog::setViewMode | ( | ViewMode | m | ) |
void QFileDialog::setViewMode | ( | ViewMode | m | ) |
bool QFileDialog::showHiddenFiles | ( | ) | const |
bool QFileDialog::showHiddenFiles | ( | ) | const |
QUrl QFileDialog::url | ( | ) | const |
Returns the URL of the current working directory in the file dialog.
QUrl QFileDialog::url | ( | ) | const |
ViewMode QFileDialog::viewMode | ( | ) | const |
ViewMode QFileDialog::viewMode | ( | ) | const |
QFileDialogQFileListView [friend] |
QFileListBox [friend] |
bool QFileDialog::contentsPreview [read, write] |
whether the file dialog can provide a contents preview of the currently selected file
The default is FALSE.
bool QFileDialog::infoPreview [read, write] |
whether the file dialog can provide preview information about the currently selected file
The default is FALSE.
Mode QFileDialog::mode [read, write] |
the file dialog's mode
The default mode is ExistingFile
.
PreviewMode QFileDialog::previewMode [read, write] |
the preview mode for the file dialog
If you set the mode to be a mode other than NoPreview, you must use setInfoPreview() or setContentsPreview() to set the dialog's preview widget to your preview widget and enable the preview widget(s) with setInfoPreviewEnabled() or setContentsPreviewEnabled().
QString QFileDialog::selectedFile [read] |
the name of the selected file
If a file was selected selectedFile contains the file's name including its absolute path; otherwise selectedFile is empty.
QStringList QFileDialog::selectedFiles [read] |
the list of selected files
If one or more files are selected, selectedFiles contains their names including their absolute paths. If no files are selected or the mode isn't ExistingFiles selectedFiles is an empty list.
It is more convenient to use selectedFile() if the mode is ExistingFile
, Directory
or DirectoryOnly
.
Note that if you want to iterate over the list, you should iterate over a copy, e.g.
QStringList list = myFileDialog.selectedFiles(); QStringList::Iterator it = list.begin(); while( it != list.end() ) { myProcessing( *it ); ++it; }
QString QFileDialog::selectedFilter [read] |
the filter which the user has selected in the file dialog
bool QFileDialog::showHiddenFiles [read, write] |
whether hidden files are shown in the file dialog
The default is FALSE, i.e. don't show hidden files.
ViewMode QFileDialog::viewMode [read, write] |
the file dialog's view mode
If you set the view mode to be Detail (the default), then you will see the file's details, such as the size of the file and the date the file was last modified in addition to the file's name.
If you set the view mode to be List, then you will just see a list of the files and folders.