qfiledialog.3qt

来自「tmark1.11:用于生成QT/EMBEDDED应用工程的Markfile文件」· 3QT 代码 · 共 381 行

3QT
381
字号
.TH QFileDialog 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQFileDialog \- The QFileDialog provides a dialog widget for inputting file names.SH SYNOPSIS.br.PP\fC#include <qfiledialog.h>\fR.PPInherits QDialog..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQFileDialog\fR ( const QString & " "dirName" ", const QString & filter = QString::null, QWidget * " "parent" "=0, const char * " "name" "=0, bool " "modal" "=FALSE )".br.ti -1c.BI "\fBQFileDialog\fR ( QWidget * " "parent" "=0, const char * " "name" "=0, bool " "modal" "=FALSE )".br.ti -1c.BI "\fB~QFileDialog\fR ()".br.ti -1c.BI "QString \fBselectedFile\fR () const".br.ti -1c.BI "void \fBsetSelection\fR ( const QString & )".br.ti -1c.BI "QString \fBdirPath\fR () const".br.ti -1c.BI "void \fBsetDir\fR ( const QDir & )".br.ti -1c.BI "const QDir* \fBdir\fR () const".br.ti -1c.BI "void \fBrereadDir\fR ()".br.ti -1c.BI "enum \fBMode\fR { AnyFile, ExistingFile, Directory, ExistingFiles }".br.ti -1c.BI "void \fBsetMode\fR ( Mode )".br.ti -1c.BI "Mode \fBmode\fR () const".br.ti -1c.BI "virtual bool \fBeventFilter\fR ( QObject *, QEvent * )".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "void \fBsetDir\fR ( const QString & )".br.ti -1c.BI "void \fBsetFilter\fR ( const QString & )".br.ti -1c.BI "void \fBsetFilters\fR ( const char ** )".br.ti -1c.BI "void \fBsetFilters\fR ( const QStringList & )".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBfileHighlighted\fR ( const QString & )".br.ti -1c.BI "void \fBfileSelected\fR ( const QString & )".br.ti -1c.BI "void \fBdirEntered\fR ( const QString & )".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "QString \fBgetOpenFileName\fR ( const QString & initially = QString::null, const QString & filter= QString::null, QWidget * " "parent" " = 0, const char * " "name" " = 0 )".br.ti -1c.BI "QString \fBgetSaveFileName\fR ( const QString & initially = QString::null, const QString & filter= QString::null, QWidget * " "parent" " = 0, const char * " "name" " = 0 )".br.ti -1c.BI "QString \fBgetExistingDirectory\fR ( const QString & dir = QString::null, QWidget * " "parent" " = 0, const char * " "name" " = 0 )".br.ti -1c.BI "QStringList \fBgetOpenFileNames\fR ( const QString & filter= QString::null, const QString & dir = QString::null, QWidget * " "parent" " = 0, const char * " "name" " = 0 )".br.ti -1c.BI "void \fBsetIconProvider\fR ( QFileIconProvider * )".br.ti -1c.BI "QFileIconProvider* \fBiconProvider\fR ()".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * )".br.ti -1c.BI "virtual void \fBkeyPressEvent\fR ( QKeyEvent * )".br.ti -1c.BI "void \fBaddWidgets\fR ( QLabel *, QWidget *, QPushButton * )".br.in -1c.SH DESCRIPTIONThe QFileDialog provides a dialog widget for inputting file names..PPExample:.PP.nf.br    QString fileName = QFileDialog::getOpenFileName();.br    if ( !fileName.isNull() ) {                 // got a file name.br        ....br    }.fi.PPThere are two ready-made convenience functions, getOpenFileName() and getSaveFileName(), which may be used like this:.PP.nf.br    QString s( QFileDialog::getOpenFileName() );.br    if ( s.isNull() ).br        return;.br.br    open( s ); // open() being your function to read the file.fi.PP<img src=qfiledlg-m.png> <img src=qfiledlg-w.png>.PPSee also: QPrintDialog..PPExamples:.(lqdir/qdir.cpp movies/main.cpp.)l.SS "Member Type Documentation".SH "QFileDialog::Mode"This enum type is used to set and read QFileDialog's operating mode. The defined values are: .IP.TP\fCAnyFile\fR - Return the name of any file, whether existing or not..TP\fCExistingFile\fR - Return the name of a single, existing, file..TP\fCDirectory\fR - Return the name of a directory..TP\fCExistingFiles\fR - Return the names of zero or more existing files..IP.PPExamples:.)l<a href="qdir-qdir-cpp.html#QFileDialog::Mode">qdir/qdir.cpp.SH MEMBER FUNCTION DOCUMENTATION.SH "QFileDialog::QFileDialog ( QWidget * parent=0, const char * name=0, bool modal=FALSE )"Constructs a file dialog with a \fIparent, name\fR and \fImodal\fR flag..PPThe dialog becomes modal if \fImodal\fR is TRUE, otherwise modeless..SH "QFileDialog::QFileDialog ( const QString & dirName, const QString & filter = QString::null, QWidget * parent=0, const char * name=0, bool modal=FALSE )"Constructs a file dialog with a \fIparent, name\fR and \fImodal\fR flag..PPThe dialog becomes modal if \fImodal\fR is TRUE, otherwise modeless..SH "QFileDialog::~QFileDialog ()"Destroys the file dialog..SH "void QFileDialog::addWidgets ( QLabel * l, QWidget * w, QPushButton * b ) \fC[protected]\fR"Adds 1-3 widgets to the bottom of the file dialog. \fIl\fR is the (optional) label, which is put beneath the "file name" and "file type" labels, \fIw\fR is a (optional) widget, which is put beneath the file type combo box, and \fIb\fR is the (you guessed it - optional) button, which is put beneath the cancel button..PPIf you don't want to add something in one of the columns, pass 0..PPIt is not currently possible to add more than one row..SH "const QDir * QFileDialog::dir () const"Returns the active directory in the file dialog..PPSee also: setDir()..SH "void QFileDialog::dirEntered ( const QString & ) \fC[signal]\fR"This signal is emitted when the user has selected a new directory..SH "QString QFileDialog::dirPath () const"Returns the active directory path string in the file dialog..PPSee also: dir() and setDir()..SH "bool QFileDialog::eventFilter ( QObject * o, QEvent * e ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QObject..SH "void QFileDialog::fileHighlighted ( const QString & ) \fC[signal]\fR"This signal is emitted when the user highlights a file..SH "void QFileDialog::fileSelected ( const QString & ) \fC[signal]\fR"This signal is emitted when the user selects a file..SH "QString QFileDialog::getExistingDirectory ( const QString & dir = QString::null, QWidget * parent = 0, const char * name = 0 ) \fC[static]\fR"Ask the user for the name of an existing directory, starting at \fIdir.\fR Returns the name of the directory the user selected..PPIf \fIdir\fR is null, getExistingDirectory() starts wherever the previous file dialog left off..SH "QString QFileDialog::getOpenFileName ( const QString & startWith = QString::null, const QString & filter= QString::null, QWidget * parent = 0, const char * name = 0 ) \fC[static]\fR"Opens a modal file dialog and returns the name of the file to be opened..PPIf \fIstartWith\fR is the name of a directory, the dialog starts off in that directory. If \fIstartWith\fR is the name of an existing file, the dialogs starts in that directory, and with \fIstartWith\fR selected..PPOnly files matching \fIfilter\fR are selectable. If \fIfilter\fR is QString::null, all files are selectable..PPIf \fIwidget\fR and/or \fIname\fR is provided, the dialog will be centered over \fIwidget\fR and named \fIname.\fR.PPgetOpenFileName() returns a null string if the user cancelled the dialog..PPThis static function is less capable than the full QFileDialog object, but is convenient and easy to use..PPExample:.PP.nf.br    // start at the current working directory and with *.cpp as filter.br    QString f = QFileDialog::getOpenFileName( QString::null, "*.cpp", this );.br    if ( !f.isEmpty() ) {.br        // the user selected a valid existing file.br    } else {.br        // the user cancelled the dialog.br    }.fi.PPgetSaveFileName() is another convenience function, equal to this one except that it allows the user to specify the name of a nonexistent file name..PPSee also: getSaveFileName()..SH "QStringList QFileDialog::getOpenFileNames ( const QString & filter= QString::null, const QString & dir = QString::null, QWidget * parent = 0, const char * name = 0 ) \fC[static]\fR"Lets the user select N files from a single directory, and returns a list of the selected files. The list may be empty, and the file names are fully qualified (i.e. "/usr/games/quake" or "c:\\\\quake\\\\quake")..PP\fIfilter\fR is the default glob pattern (which the user can change). The default is all files. \fIdir\fR is the starting directory. If \fIdir\fR is not supplied, QFileDialog picks something presumably useful (such as the directory where the user selected something last, or the current working directory)..PP\fIparent\fR is a widget over which the dialog should be positioned and \fIname\fR is the object name of the temporary QFileDialog object..PPExample:.PP.nf.br    QStringList s( QFileDialog::getOpenFileNames() );.br    // do something with the files in s..fi.SH "QString QFileDialog::getSaveFileName ( const QString & startWith = QString::null, const QString & filter= QString::null, QWidget * parent = 0, const char * name = 0 ) \fC[static]\fR"Opens a modal file dialog and returns the name of the file to be saved..PPIf \fIstartWith\fR is the name of a directory, the dialog starts off in that directory. If \fIstartWith\fR is the name of an existing file, the dialogs starts in that directory, and with \fIstartWith\fR selected..PPOnly files matching \fIfilter\fR are selectable. If \fIfilter\fR is QString::null, all files are selectable..PPIf \fIwidget\fR and/or \fIname\fR is provided, the dialog will be centered over \fIwidget\fR and named \fIname.\fR.PPReturns a null string if the user cancelled the dialog..PPThis static function is less capable than the full QFileDialog object, but is convenient and easy to use..PPExample:.PP.nf.br    // start at the current working directory and with *.cpp as filter.br    QString f = QFileDialog::getSaveFileName( QString::null, "*.cpp", this );.br    if ( !f.isEmpty() ) {.br        // the user gave a file name.br    } else {.br        // the user cancelled the dialog.br    }.fi.PPgetOpenFileName() is another convenience function, equal to this one except that it does not allow the user to specify the name of a nonexistent file name..PPSee also: getOpenFileName()..SH "QFileIconProvider * QFileDialog::iconProvider () \fC[static]\fR"Returns the icon provider currently in use. By default there is no icon provider and this function returns 0..PPSee also: setIconProvider() and QFileIconProvider..SH "void QFileDialog::keyPressEvent ( QKeyEvent * ke ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QFileDialog::Mode QFileDialog::mode() const"Returns the file mode of this dialog..PPSee also: setMode()..SH "void QFileDialog::rereadDir ()"Re-reads the active directory in the file dialog..PPIt is seldom necessary to call this function. It is provided in case the directory contents change and you want to refresh the directory list box..SH "void QFileDialog::resizeEvent ( QResizeEvent * ) \fC[virtual protected]\fR"Handles resize events for the file dialog..PPReimplemented from QWidget..SH "QString QFileDialog::selectedFile () const"Returns the selected file name..PPIf a file name was selected, the returned string contains the absolute path name. The returned string is a null string if no file name was selected..PPSee also: QString::isNull()..PPExamples:.(lqdir/qdir.cpp.)l.SH "void QFileDialog::setDir ( const QDir & dir )"Sets a directory path for the file dialog..PPSee also: dir()..SH "void QFileDialog::setDir ( const QString & pathstr ) \fC[slot]\fR"Sets a directory path string for the file dialog..PPSee also: dir()..SH "void QFileDialog::setFilter ( const QString & newFilter ) \fC[slot]\fR"Sets the filter spec in use to \fInewFilter.\fR.PPIf \fInewFilter\fR matches the regular expression \fC([a-zA-Z0-9\\.\\*\\?]*)$\fR (ie. it ends with a normal wildcard expression enclosed in parentheses), only the parenthesized is used. This means that these two calls are equivalent:.PP.nf.br     fd->setFilter( "All perl files (*.pl)" );.br     fd->setFilter( "*.pl" ).fi.SH "void QFileDialog::setFilters ( const char ** types ) \fC[slot]\fR"Sets this file dialog to offer \fItypes\fR in the File Type combo box. \fItypes\fR must be a null-terminated list of strings; each string must be in the format described in the documentation for setFilter()..PPSee also: setFilter()..SH "void QFileDialog::setFilters ( const QStringList & ) \fC[slot]\fR"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..SH "void QFileDialog::setIconProvider ( QFileIconProvider * provider ) \fC[static]\fR"Sets all file dialogs to use \fIprovider\fR to select icons to draw for each file. By default there is no icon provider, and QFileDialog simply draws a "folder" icon next to each directory and nothing next to the files..PPSee also: QFileIconProvider and iconProvider()..SH "void QFileDialog::setMode ( Mode newMode )"Sets this file dialog to \fInewMode,\fR which can be one of \fCDirectory\fR (directories are accepted), \fCExistingFile\fR (existing files are accepted), \fCAnyFile\fR (any valid file name is accepted) or \fCExistingFiles\fR (like \fCExistingFile,\fR but multple files may be selected).PPSee also: mode()..PPExamples:.(lqdir/qdir.cpp.)l.SH "void QFileDialog::setSelection ( const QString & filename )"Sets the default selection to \fIfilename.\fR If \fIfilename\fR is absolute, setDir() is also called..PPExamples:.(lqdir/qdir.cpp.)l.SH "SEE ALSO".BR http://www.troll.no/qt/qfiledialog.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS.  See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?