⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qfiledialog.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 3 页
字号:
.PP.nf.br    class Preview : public QLabel, public QFilePreview.br    {.br    public:.br        Preview( QWidget *parent=0 ) : QLabel( parent ) {}.br.br        void previewUrl( const QUrl &u ).br        {.br            QString path = u.path();.br            QPixmap pix( path );.br            if ( pix.isNull() ).br                setText( "This is not a pixmap" );.br            else.br                setPixmap( pix );.br        }.br    };.br.br  //....br.br  int main( int argc, char** argv ).br  {.br    Preview* p = new Preview;.br.br    QFileDialog* fd = new QFileDialog( this );.br    fd->setContentsPreviewEnabled( TRUE );.br    fd->setContentsPreview( p, p );.br    fd->setPreviewMode( QFileDialog::Contents );.br    fd->show();.br  }.br.fi.PPSee also contentsPreview, setInfoPreview(), and previewMode..PPExample: qdir/qdir.cpp..SH "void QFileDialog::setContentsPreviewEnabled ( bool )"Sets whether the file dialog can provide a contents preview of the currently selected file. See the "contentsPreview" property for details..SH "void QFileDialog::setDir ( const QDir & dir )"Sets the file dialog's working directory to \fIdir\fR..PPSee also dir()..SH "void QFileDialog::setDir ( const QString & pathstr )\fC [slot]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the file dialog's working directory to \fIpathstr\fR..PPSee also dir()..SH "void QFileDialog::setFilter ( const QString & newFilter )\fC [slot]\fR"Sets the filter used in the file dialog to \fInewFilter\fR..PPIf \fInewFilter\fR contains a pair of parentheses containing one or more of \fI\fBanything*something\fR\fR 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:.PP.nf.br     fd->setFilter( "All C++ files (*.cpp *.cc *.C *.cxx *.c++)" );.br     fd->setFilter( "*.cpp *.cc *.C *.cxx *.c++" );.br     fd->setFilter( "All C++ files (*.cpp;*.cc;*.C;*.cxx;*.c++)" );.br     fd->setFilter( "*.cpp;*.cc;*.C;*.cxx;*.c++" );.br.fi.PPSee also setFilters()..SH "void QFileDialog::setFilters ( const QString & filters )\fC [slot]\fR"Sets the filters used in the file dialog to \fIfilters\fR. Each group of filters must be separated by \fC;;\fR (\fItwo\fR semi-colons)..PP.nf.br    QString types("Image files (*.png *.xpm *.jpg);;".br                  "Text files (*.txt);;".br                  "Any files (*)");.br    QFileDialog fd = new QFileDialog( this );.br    fd->setFilters( types );.br    fd->show();.br.fi.SH "void QFileDialog::setFilters ( const char ** types )\fC [slot]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PP\fItypes\fR must be a null-terminated list of strings..SH "void QFileDialog::setFilters ( const QStringList & )\fC [slot]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..SH "void QFileDialog::setIconProvider ( QFileIconProvider * provider )\fC [static]\fR"Sets the QFileIconProvider used by the file dialog to \fIprovider\fR..PPThe default is that there is no QFileIconProvider and QFileDialog just draws a folder icon next to each directory and nothing next to files..PPSee also QFileIconProvider and iconProvider()..PPExample: showimg/main.cpp..SH "void QFileDialog::setInfoPreview ( QWidget * w, QFilePreview * preview )"Sets the widget to be used for displaying information about the file to the widget \fIw\fR and a preview of that information to the QFilePreview \fIpreview\fR..PPNormally you would create a preview widget that derives from both QWidget and QFilePreview, so you should pass the same widget twice..PP.nf.br    class Preview : public QLabel, public QFilePreview.br    {.br    public:.br        Preview( QWidget *parent=0 ) : QLabel( parent ) {}.br.br        void previewUrl( const QUrl &u ).br        {.br            QString path = u.path();.br            QPixmap pix( path );.br            if ( pix.isNull() ).br                setText( "This is not a pixmap" );.br            else.br                setText( "This is a pixmap" );.br        }.br    };.br.br  //....br.br  int main( int argc, char** argv ).br  {.br    Preview* p = new Preview;.br.br    QFileDialog* fd = new QFileDialog( this );.br    fd->setInfoPreviewEnabled( TRUE );.br    fd->setInfoPreview( p, p );.br    fd->setPreviewMode( QFileDialog::Info );.br    fd->show();.br  }.br.br.fi.PPSee also setContentsPreview(), infoPreview, and previewMode..SH "void QFileDialog::setInfoPreviewEnabled ( bool )"Sets whether the file dialog can provide preview information about the currently selected file. See the "infoPreview" property for details..SH "void QFileDialog::setMode ( Mode )"Sets the file dialog's mode. See the "mode" property for details..SH "void QFileDialog::setPreviewMode ( PreviewMode m )"Sets the preview mode for the file dialog to \fIm\fR. See the "previewMode" property for details..SH "void QFileDialog::setSelectedFilter ( const QString & mask )\fC [virtual]\fR"Sets the current filter selected in the file dialog to the first one that contains the text \fImask\fR..SH "void QFileDialog::setSelectedFilter ( int n )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the current filter selected in the file dialog to the \fIn\fR-th filter in the filter list..PPSee also filterSelected(), selectedFilter, selectedFiles, and selectedFile..SH "void QFileDialog::setSelection ( const QString & filename )"Sets the default selection to \fIfilename\fR. If \fIfilename\fR is absolute, setDir() is also called to set the file dialog's working directory to the filename's directory..PPExample: qdir/qdir.cpp..SH "void QFileDialog::setShowHiddenFiles ( bool s )"Sets whether hidden files are shown in the file dialog to \fIs\fR. See the "showHiddenFiles" property for details..SH "void QFileDialog::setUrl ( const QUrlOperator & url )\fC [slot]\fR"Sets the file dialog's working directory to the directory specified at \fIurl\fR..PPSee also url()..SH "void QFileDialog::setViewMode ( ViewMode m )"Sets the file dialog's view mode to \fIm\fR. See the "viewMode" property for details..SH "bool QFileDialog::showHiddenFiles () const"Returns TRUE if hidden files are shown in the file dialog; otherwise returns FALSE. See the "showHiddenFiles" property for details..SH "QUrl QFileDialog::url () const"Returns the URL of the current working directory in the file dialog..PPSee also setUrl()..PPExample: network/networkprotocol/view.cpp..SH "ViewMode QFileDialog::viewMode () const"Returns the file dialog's view mode. See the "viewMode" property for details..SS "Property Documentation".SH "bool contentsPreview"This property holds whether the file dialog can provide a contents preview of the currently selected file..PPThe default is FALSE..PPSee also setContentsPreview() and infoPreview..PPSet this property's value with setContentsPreviewEnabled() and get this property's value with isContentsPreviewEnabled()..SH "QString dirPath"This property holds the file dialog's working directory..PPGet this property's value with dirPath()..PPSee also dir() and setDir()..SH "bool infoPreview"This property holds whether the file dialog can provide preview information about the currently selected file..PPThe default is FALSE..PPSet this property's value with setInfoPreviewEnabled() and get this property's value with isInfoPreviewEnabled()..SH "Mode mode"This property holds the file dialog's mode..PPThe default mode is ExistingFile..PPSet this property's value with setMode() and get this property's value with mode()..SH "PreviewMode previewMode"This property holds the preview mode for the file dialog..PPIf you set the mode to be a mode other than \fINoPreview\fR, 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()..PPSee also infoPreview, contentsPreview, and viewMode..PPSet this property's value with setPreviewMode() and get this property's value with previewMode()..SH "QString selectedFile"This property holds the name of the selected file..PPIf a file was selected selectedFile contains the file's name including its absolute path; otherwise selectedFile is empty..PPSee also QString::isEmpty(), selectedFiles, and selectedFilter..PPGet this property's value with selectedFile()..SH "QStringList selectedFiles"This property holds the list of selected files..PPIf 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..PPIt is more convenient to use selectedFile() if the mode is ExistingFile, Directory or DirectoryOnly..PPNote that if you want to iterate over the list, you should iterate over a copy, e.g..PP.nf.br    QStringList list = myFileDialog.selectedFiles();.br    QStringList::Iterator it = list.begin();.br    while( it != list.end() ) {.br        myProcessing( *it );.br        ++it;.br    }.br.fi.PPSee also selectedFile, selectedFilter, and QValueList::empty()..PPGet this property's value with selectedFiles()..SH "QString selectedFilter"This property holds the filter which the user has selected in the file dialog..PPGet this property's value with selectedFilter()..PPSee also filterSelected(), selectedFiles, and selectedFile..SH "bool showHiddenFiles"This property holds whether hidden files are shown in the file dialog..PPThe default is FALSE, i.e. don't show hidden files..PPSet this property's value with setShowHiddenFiles() and get this property's value with showHiddenFiles()..SH "ViewMode viewMode"This property holds the file dialog's view mode..PPIf you set the view mode to be \fIDetail\fR (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..PPIf you set the view mode to be \fIList\fR, then you will just see a list of the files and folders..PPSee QFileDialog::ViewMode.PPSet this property's value with setViewMode() and get this property's value with viewMode()..SH "SEE ALSO".BR http://doc.trolltech.com/qfiledialog.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qfiledialog.3qt) and the Qtversion (3.1.1).

⌨️ 快捷键说明

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