[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/dialogs/qfiledialog.cpp:2159 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QFileDialog Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QFileDialog Class Reference</h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QFileDialog class provides dialogs that allow users to select files or directories.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qfiledialog-h.html">qfiledialog.h</a>></tt>
|
---|
| 37 | <p>Inherits <a href="qdialog.html">QDialog</a>.
|
---|
| 38 | <p><a href="qfiledialog-members.html">List of all member functions.</a>
|
---|
| 39 | <h2>Public Members</h2>
|
---|
| 40 | <ul>
|
---|
| 41 | <li class=fn><a href="#QFileDialog"><b>QFileDialog</b></a> ( const QString & dirName, const QString & filter = QString::null, QWidget * parent = 0, const char * name = 0, bool modal = FALSE )</li>
|
---|
| 42 | <li class=fn><a href="#QFileDialog-2"><b>QFileDialog</b></a> ( QWidget * parent = 0, const char * name = 0, bool modal = FALSE )</li>
|
---|
| 43 | <li class=fn><a href="#~QFileDialog"><b>~QFileDialog</b></a> ()</li>
|
---|
| 44 | <li class=fn>QString <a href="#selectedFile"><b>selectedFile</b></a> () const</li>
|
---|
| 45 | <li class=fn>QString <a href="#selectedFilter"><b>selectedFilter</b></a> () const</li>
|
---|
| 46 | <li class=fn>virtual void <a href="#setSelectedFilter"><b>setSelectedFilter</b></a> ( const QString & mask )</li>
|
---|
| 47 | <li class=fn>virtual void <a href="#setSelectedFilter-2"><b>setSelectedFilter</b></a> ( int n )</li>
|
---|
| 48 | <li class=fn>void <a href="#setSelection"><b>setSelection</b></a> ( const QString & filename )</li>
|
---|
| 49 | <li class=fn>void <a href="#selectAll"><b>selectAll</b></a> ( bool b )</li>
|
---|
| 50 | <li class=fn>QStringList <a href="#selectedFiles"><b>selectedFiles</b></a> () const</li>
|
---|
| 51 | <li class=fn>QString <a href="#dirPath"><b>dirPath</b></a> () const</li>
|
---|
| 52 | <li class=fn>void <a href="#setDir"><b>setDir</b></a> ( const QDir & dir )</li>
|
---|
| 53 | <li class=fn>const QDir * <a href="#dir"><b>dir</b></a> () const</li>
|
---|
| 54 | <li class=fn>void <a href="#setShowHiddenFiles"><b>setShowHiddenFiles</b></a> ( bool s )</li>
|
---|
| 55 | <li class=fn>bool <a href="#showHiddenFiles"><b>showHiddenFiles</b></a> () const</li>
|
---|
| 56 | <li class=fn>void <a href="#rereadDir"><b>rereadDir</b></a> ()</li>
|
---|
| 57 | <li class=fn>void <a href="#resortDir"><b>resortDir</b></a> ()</li>
|
---|
| 58 | <li class=fn>enum <a href="#Mode-enum"><b>Mode</b></a> { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly }</li>
|
---|
| 59 | <li class=fn>void <a href="#setMode"><b>setMode</b></a> ( Mode )</li>
|
---|
| 60 | <li class=fn>Mode <a href="#mode"><b>mode</b></a> () const</li>
|
---|
| 61 | <li class=fn>enum <a href="#ViewMode-enum"><b>ViewMode</b></a> { Detail, List }</li>
|
---|
| 62 | <li class=fn>enum <a href="#PreviewMode-enum"><b>PreviewMode</b></a> { NoPreview, Contents, Info }</li>
|
---|
| 63 | <li class=fn>void <a href="#setViewMode"><b>setViewMode</b></a> ( ViewMode m )</li>
|
---|
| 64 | <li class=fn>ViewMode <a href="#viewMode"><b>viewMode</b></a> () const</li>
|
---|
| 65 | <li class=fn>void <a href="#setPreviewMode"><b>setPreviewMode</b></a> ( PreviewMode m )</li>
|
---|
| 66 | <li class=fn>PreviewMode <a href="#previewMode"><b>previewMode</b></a> () const</li>
|
---|
| 67 | <li class=fn>bool <a href="#isInfoPreviewEnabled"><b>isInfoPreviewEnabled</b></a> () const</li>
|
---|
| 68 | <li class=fn>bool <a href="#isContentsPreviewEnabled"><b>isContentsPreviewEnabled</b></a> () const</li>
|
---|
| 69 | <li class=fn>void <a href="#setInfoPreviewEnabled"><b>setInfoPreviewEnabled</b></a> ( bool )</li>
|
---|
| 70 | <li class=fn>void <a href="#setContentsPreviewEnabled"><b>setContentsPreviewEnabled</b></a> ( bool )</li>
|
---|
| 71 | <li class=fn>void <a href="#setInfoPreview"><b>setInfoPreview</b></a> ( QWidget * w, QFilePreview * preview )</li>
|
---|
| 72 | <li class=fn>void <a href="#setContentsPreview"><b>setContentsPreview</b></a> ( QWidget * w, QFilePreview * preview )</li>
|
---|
| 73 | <li class=fn>QUrl <a href="#url"><b>url</b></a> () const</li>
|
---|
| 74 | <li class=fn>void <a href="#addFilter"><b>addFilter</b></a> ( const QString & filter )</li>
|
---|
| 75 | </ul>
|
---|
| 76 | <h2>Public Slots</h2>
|
---|
| 77 | <ul>
|
---|
| 78 | <li class=fn>void <a href="#setDir-2"><b>setDir</b></a> ( const QString & pathstr )</li>
|
---|
| 79 | <li class=fn>void <a href="#setUrl"><b>setUrl</b></a> ( const QUrlOperator & url )</li>
|
---|
| 80 | <li class=fn>void <a href="#setFilter"><b>setFilter</b></a> ( const QString & newFilter )</li>
|
---|
| 81 | <li class=fn>void <a href="#setFilters"><b>setFilters</b></a> ( const QString & filters )</li>
|
---|
| 82 | <li class=fn>void <a href="#setFilters-2"><b>setFilters</b></a> ( const char ** types )</li>
|
---|
| 83 | <li class=fn>void <a href="#setFilters-3"><b>setFilters</b></a> ( const QStringList & )</li>
|
---|
| 84 | </ul>
|
---|
| 85 | <h2>Signals</h2>
|
---|
| 86 | <ul>
|
---|
| 87 | <li class=fn>void <a href="#fileHighlighted"><b>fileHighlighted</b></a> ( const QString & )</li>
|
---|
| 88 | <li class=fn>void <a href="#fileSelected"><b>fileSelected</b></a> ( const QString & )</li>
|
---|
| 89 | <li class=fn>void <a href="#filesSelected"><b>filesSelected</b></a> ( const QStringList & )</li>
|
---|
| 90 | <li class=fn>void <a href="#dirEntered"><b>dirEntered</b></a> ( const QString & )</li>
|
---|
| 91 | <li class=fn>void <a href="#filterSelected"><b>filterSelected</b></a> ( const QString & )</li>
|
---|
| 92 | </ul>
|
---|
| 93 | <h2>Static Public Members</h2>
|
---|
| 94 | <ul>
|
---|
| 95 | <li class=fn>QString <a href="#getOpenFileName"><b>getOpenFileName</b></a> ( 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 )</li>
|
---|
| 96 | <li class=fn>QString <a href="#getSaveFileName"><b>getSaveFileName</b></a> ( 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 )</li>
|
---|
| 97 | <li class=fn>QString <a href="#getExistingDirectory"><b>getExistingDirectory</b></a> ( const QString & dir = QString::null, QWidget * parent = 0, const char * name = 0, const QString & caption = QString::null, bool dirOnly = TRUE, bool resolveSymlinks = TRUE )</li>
|
---|
| 98 | <li class=fn>QStringList <a href="#getOpenFileNames"><b>getOpenFileNames</b></a> ( 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 )</li>
|
---|
| 99 | <li class=fn>void <a href="#setIconProvider"><b>setIconProvider</b></a> ( QFileIconProvider * provider )</li>
|
---|
| 100 | <li class=fn>QFileIconProvider * <a href="#iconProvider"><b>iconProvider</b></a> ()</li>
|
---|
| 101 | </ul>
|
---|
| 102 | <h2>Properties</h2>
|
---|
| 103 | <ul>
|
---|
| 104 | <li class=fn>bool <a href="#contentsPreview-prop"><b>contentsPreview</b></a> - whether the file dialog can provide a contents preview of the currently selected file</li>
|
---|
| 105 | <li class=fn>QString <a href="#dirPath-prop"><b>dirPath</b></a> - the file dialog's working directory <em>(read only)</em></li>
|
---|
| 106 | <li class=fn>bool <a href="#infoPreview-prop"><b>infoPreview</b></a> - whether the file dialog can provide preview information about the currently selected file</li>
|
---|
| 107 | <li class=fn>Mode <a href="#mode-prop"><b>mode</b></a> - the file dialog's mode</li>
|
---|
| 108 | <li class=fn>PreviewMode <a href="#previewMode-prop"><b>previewMode</b></a> - the preview mode for the file dialog</li>
|
---|
| 109 | <li class=fn>QString <a href="#selectedFile-prop"><b>selectedFile</b></a> - the name of the selected file <em>(read only)</em></li>
|
---|
| 110 | <li class=fn>QStringList <a href="#selectedFiles-prop"><b>selectedFiles</b></a> - the list of selected files <em>(read only)</em></li>
|
---|
| 111 | <li class=fn>QString <a href="#selectedFilter-prop"><b>selectedFilter</b></a> - the filter which the user has selected in the file dialog <em>(read only)</em></li>
|
---|
| 112 | <li class=fn>bool <a href="#showHiddenFiles-prop"><b>showHiddenFiles</b></a> - whether hidden files are shown in the file dialog</li>
|
---|
| 113 | <li class=fn>ViewMode <a href="#viewMode-prop"><b>viewMode</b></a> - the file dialog's view mode</li>
|
---|
| 114 | </ul>
|
---|
| 115 | <h2>Protected Members</h2>
|
---|
| 116 | <ul>
|
---|
| 117 | <li class=fn>void <a href="#addWidgets"><b>addWidgets</b></a> ( QLabel * l, QWidget * w, QPushButton * b )</li>
|
---|
| 118 | <li class=fn>void <a href="#addToolButton"><b>addToolButton</b></a> ( QButton * b, bool separator = FALSE )</li>
|
---|
| 119 | <li class=fn>void <a href="#addLeftWidget"><b>addLeftWidget</b></a> ( QWidget * w )</li>
|
---|
| 120 | <li class=fn>void <a href="#addRightWidget"><b>addRightWidget</b></a> ( QWidget * w )</li>
|
---|
| 121 | </ul>
|
---|
| 122 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 123 |
|
---|
| 124 |
|
---|
| 125 | The QFileDialog class provides dialogs that allow users to select files or directories.
|
---|
| 126 |
|
---|
| 127 |
|
---|
| 128 | <p> The QFileDialog class enables a user to traverse their file system in
|
---|
| 129 | order to select one or many files or a directory.
|
---|
| 130 | <p> The easiest way to create a QFileDialog is to use the static
|
---|
| 131 | functions. On Windows, these static functions will call the native
|
---|
| 132 | Windows file dialog and on Mac OS X, these static function will call
|
---|
| 133 | the native Mac OS X file dialog.
|
---|
| 134 | <p> <pre>
|
---|
| 135 | <a href="qstring.html">QString</a> s = QFileDialog::<a href="#getOpenFileName">getOpenFileName</a>(
|
---|
| 136 | "/home",
|
---|
| 137 | "Images (*.png *.xpm *.jpg)",
|
---|
| 138 | this,
|
---|
| 139 | "open file dialog",
|
---|
| 140 | "Choose a file" );
|
---|
| 141 | </pre>
|
---|
| 142 |
|
---|
| 143 | <p> In the above example, a modal QFileDialog is created using a static
|
---|
| 144 | function. The startup directory is set to "/home". The file filter
|
---|
| 145 | is set to "Images (*.png *.xpm *.jpg)". The parent of the file dialog
|
---|
| 146 | is set to <em>this</em> and it is given the identification name - "open file
|
---|
| 147 | dialog". The caption at the top of file dialog is set to "Choose a
|
---|
| 148 | file". If you want to use multiple filters, separate each one with
|
---|
| 149 | <em>two</em> semi-colons, e.g.
|
---|
| 150 | <pre>
|
---|
| 151 | "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
|
---|
| 152 | </pre>
|
---|
| 153 |
|
---|
| 154 | <p> You can create your own QFileDialog without using the static
|
---|
| 155 | functions. By calling <a href="#setMode">setMode</a>(), you can set what can be returned by
|
---|
| 156 | the QFileDialog.
|
---|
| 157 | <p> <pre>
|
---|
| 158 | QFileDialog* fd = new QFileDialog( this, "file dialog", TRUE );
|
---|
| 159 | fd-><a href="#setMode">setMode</a>( QFileDialog::<a href="#Mode-enum">AnyFile</a> );
|
---|
| 160 | </pre>
|
---|
| 161 |
|
---|
| 162 | <p> In the above example, the mode of the file dialog is set to <a href="#Mode-enum">AnyFile</a>, meaning that the user can select any file, or even specify a
|
---|
| 163 | file that doesn't exist. This mode is useful for creating a "File Save
|
---|
| 164 | As" file dialog. Use <a href="#Mode-enum">ExistingFile</a> if the user must select an
|
---|
| 165 | existing file or <a href="#Mode-enum">Directory</a> if only a directory may be selected.
|
---|
| 166 | (See the <a href="#Mode-enum">QFileDialog::Mode</a> enum for the complete list of modes.)
|
---|
| 167 | <p> You can retrieve the dialog's mode with <a href="#mode">mode</a>(). Use <a href="#setFilter">setFilter</a>() to set
|
---|
| 168 | the dialog's file filter, e.g.
|
---|
| 169 | <p> <pre>
|
---|
| 170 | fd->setFilter( "Images (*.png *.xpm *.jpg)" );
|
---|
| 171 | </pre>
|
---|
| 172 |
|
---|
| 173 | <p> In the above example, the filter is set to "Images (*.png *.xpm
|
---|
| 174 | *.jpg)", this means that only files with the extension <tt>png</tt>, <tt>xpm</tt>
|
---|
| 175 | or <tt>jpg</tt> will be shown in the QFileDialog. You can apply
|
---|
| 176 | several filters by using <a href="#setFilters">setFilters</a>() and add additional filters with
|
---|
| 177 | <a href="#addFilter">addFilter</a>(). Use <a href="#setSelectedFilter">setSelectedFilter</a>() to select one of the filters
|
---|
| 178 | you've given as the file dialog's default filter. Whenever the user
|
---|
| 179 | changes the filter the <a href="#filterSelected">filterSelected</a>() signal is emitted.
|
---|
| 180 | <p> The file dialog has two view modes, QFileDialog::List which simply
|
---|
| 181 | lists file and directory names and QFileDialog::Detail which
|
---|
| 182 | displays additional information alongside each name, e.g. file size,
|
---|
| 183 | modification date, etc. Set the mode with <a href="#setViewMode">setViewMode</a>().
|
---|
| 184 | <p> <pre>
|
---|
| 185 | fd->setViewMode( QFileDialog::<a href="#ViewMode-enum">Detail</a> );
|
---|
| 186 | </pre>
|
---|
| 187 |
|
---|
| 188 | <p> The last important function you will need to use when creating your
|
---|
| 189 | own file dialog is <a href="#selectedFile">selectedFile</a>().
|
---|
| 190 | <p> <pre>
|
---|
| 191 | <a href="qstring.html">QString</a> fileName;
|
---|
| 192 | if ( fd->exec() == QDialog::<a href="qdialog.html#DialogCode-enum">Accepted</a> )
|
---|
| 193 | fileName = fd->selectedFile();
|
---|
| 194 | </pre>
|
---|
| 195 |
|
---|
| 196 | <p> In the above example, a modal file dialog is created and shown. If
|
---|
| 197 | the user clicked OK, then the file they selected is put in <tt>fileName</tt>.
|
---|
| 198 | <p> If you are using the <a href="#Mode-enum">ExistingFiles</a> mode then you will need to use
|
---|
| 199 | <a href="#selectedFiles">selectedFiles</a>() which will return the selected files in a <a href="qstringlist.html">QStringList</a>.
|
---|
| 200 | <p> The dialog's working directory can be set with <a href="#setDir">setDir</a>(). The display
|
---|
| 201 | of hidden files is controlled with <a href="#setShowHiddenFiles">setShowHiddenFiles</a>(). The dialog
|
---|
| 202 | can be forced to re-read the directory with <a href="#rereadDir">rereadDir</a>() and re-sort
|
---|
| 203 | the directory with <a href="#resortDir">resortDir</a>(). All the files in the current directory
|
---|
| 204 | can be selected with <a href="#selectAll">selectAll</a>().
|
---|
| 205 | <p> <h3> Creating and using preview widgets
|
---|
| 206 | </h3>
|
---|
| 207 | <a name="1"></a><p> There are two kinds of preview widgets that can be used with
|
---|
| 208 | QFileDialogs: <em>content</em> preview widgets and <em>information</em> preview
|
---|
| 209 | widgets. They are created and used in the same way except that the
|
---|
| 210 | function names differ, e.g. <a href="#setContentsPreview">setContentsPreview</a>() and <a href="#setInfoPreview">setInfoPreview</a>().
|
---|
| 211 | <p> A preview widget is a widget that is placed inside a QFileDialog so
|
---|
| 212 | that the user can see either the contents of the file, or information
|
---|
| 213 | about the file.
|
---|
| 214 | <p> <pre>
|
---|
| 215 | class Preview : public <a href="qlabel.html">QLabel</a>, public QFilePreview
|
---|
| 216 | {
|
---|
| 217 | public:
|
---|
| 218 | Preview( <a href="qwidget.html">QWidget</a> *parent=0 ) : <a href="qlabel.html">QLabel</a>( parent ) {}
|
---|
| 219 |
|
---|
| 220 | void previewUrl( const <a href="qurl.html">QUrl</a> &u )
|
---|
| 221 | {
|
---|
| 222 | <a href="qstring.html">QString</a> path = u.<a href="qurl.html#path">path</a>();
|
---|
| 223 | <a href="qpixmap.html">QPixmap</a> pix( path );
|
---|
| 224 | if ( pix.<a href="qpixmap.html#isNull">isNull</a>() )
|
---|
| 225 | setText( "This is not a pixmap" );
|
---|
| 226 | else
|
---|
| 227 | setPixmap( pix );
|
---|
| 228 | }
|
---|
| 229 | };
|
---|
| 230 | </pre>
|
---|
| 231 |
|
---|
| 232 | <p> In the above snippet, we create a preview widget which inherits from
|
---|
| 233 | <a href="qlabel.html">QLabel</a> and <a href="qfilepreview.html">QFilePreview</a>. File preview widgets <em>must</em> inherit from
|
---|
| 234 | QFilePreview.
|
---|
| 235 | <p> Inside the class we reimplement <a href="qfilepreview.html#previewUrl">QFilePreview::previewUrl</a>(), this is
|
---|
| 236 | where we determine what happens when a file is selected. In the
|
---|
| 237 | above example we only show a preview of the file if it is a valid
|
---|
| 238 | pixmap. Here's how to make a file dialog use a preview widget:
|
---|
| 239 | <p> <pre>
|
---|
| 240 | Preview* p = new Preview;
|
---|
| 241 |
|
---|
| 242 | QFileDialog* fd = new QFileDialog( this );
|
---|
| 243 | fd-><a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE );
|
---|
| 244 | fd-><a href="#setContentsPreview">setContentsPreview</a>( p, p );
|
---|
| 245 | fd-><a href="#setPreviewMode">setPreviewMode</a>( QFileDialog::<a href="#PreviewMode-enum">Contents</a> );
|
---|
| 246 | fd-><a href="qdialog.html#show">show</a>();
|
---|
| 247 | </pre>
|
---|
| 248 |
|
---|
| 249 | <p> The first line creates an instance of our preview widget. We then
|
---|
| 250 | create our file dialog and call <a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE ),
|
---|
| 251 | this tell the file dialog to preview the contents of the currently
|
---|
| 252 | selected file. We then call <a href="#setContentsPreview">setContentsPreview</a>() -- note that we pass
|
---|
| 253 | the same preview widget twice. Finally, before showing the file
|
---|
| 254 | dialog, we call <a href="#setPreviewMode">setPreviewMode</a>() setting the mode to <em>Contents</em> which
|
---|
| 255 | will show the contents preview of the file that the user has selected.
|
---|
| 256 | <p> If you create another preview widget that is used for displaying
|
---|
| 257 | information about a file, create it in the same way as the contents
|
---|
| 258 | preview widget and call <a href="#setInfoPreviewEnabled">setInfoPreviewEnabled</a>(), and
|
---|
| 259 | <a href="#setInfoPreview">setInfoPreview</a>(). Then the user will be able to switch between the
|
---|
| 260 | two preview modes.
|
---|
| 261 | <p> For more information about creating a <a href="qfilepreview.html">QFilePreview</a> widget see
|
---|
| 262 | <a href="qfilepreview.html">QFilePreview</a>.
|
---|
| 263 | <p> <img src=qfiledlg-m.png> <img src=qfiledlg-w.png>
|
---|
| 264 | <p> <p>See also <a href="dialogs.html">Dialog Classes</a>.
|
---|
| 265 |
|
---|
| 266 | <hr><h2>Member Type Documentation</h2>
|
---|
| 267 | <h3 class=fn><a name="Mode-enum"></a>QFileDialog::Mode</h3>
|
---|
| 268 | <p> This enum is used to indicate what the user may select in the file
|
---|
| 269 | dialog, i.e. what the dialog will return if the user clicks OK.
|
---|
| 270 | <ul>
|
---|
| 271 | <li><tt>QFileDialog::AnyFile</tt> - The name of a file, whether it exists or not.
|
---|
| 272 | <li><tt>QFileDialog::ExistingFile</tt> - The name of a single existing file.
|
---|
| 273 | <li><tt>QFileDialog::Directory</tt> - The name of a directory. Both files and directories
|
---|
| 274 | are displayed.
|
---|
| 275 | <li><tt>QFileDialog::DirectoryOnly</tt> - The name of a directory. The file dialog will only display directories.
|
---|
| 276 | <li><tt>QFileDialog::ExistingFiles</tt> - The names of zero or more existing files.
|
---|
| 277 | </ul><p> See <a href="#setMode">setMode</a>().
|
---|
| 278 |
|
---|
| 279 | <h3 class=fn><a name="PreviewMode-enum"></a>QFileDialog::PreviewMode</h3>
|
---|
| 280 |
|
---|
| 281 | <p> This enum describes the preview mode of the file dialog.
|
---|
| 282 | <ul>
|
---|
| 283 | <li><tt>QFileDialog::NoPreview</tt> - No preview is shown at all.
|
---|
| 284 | <li><tt>QFileDialog::Contents</tt> - Show a preview of the contents of the current file
|
---|
| 285 | using the contents preview widget.
|
---|
| 286 | <li><tt>QFileDialog::Info</tt> - Show information about the current file using the
|
---|
| 287 | info preview widget.
|
---|
| 288 | </ul><p> See <a href="#setPreviewMode">setPreviewMode</a>(), <a href="#setContentsPreview">setContentsPreview</a>() and <a href="#setInfoPreview">setInfoPreview</a>().
|
---|
| 289 |
|
---|
| 290 | <h3 class=fn><a name="ViewMode-enum"></a>QFileDialog::ViewMode</h3>
|
---|
| 291 |
|
---|
| 292 | <p> This enum describes the view mode of the file dialog, i.e. what
|
---|
| 293 | information about each file will be displayed.
|
---|
| 294 | <ul>
|
---|
| 295 | <li><tt>QFileDialog::List</tt> - Display file and directory names with icons.
|
---|
| 296 | <li><tt>QFileDialog::Detail</tt> - Display file and directory names with icons plus
|
---|
| 297 | additional information, such as file size and modification date.
|
---|
| 298 | </ul><p> See <a href="#setViewMode">setViewMode</a>().
|
---|
| 299 |
|
---|
| 300 | <hr><h2>Member Function Documentation</h2>
|
---|
| 301 | <h3 class=fn><a name="QFileDialog"></a>QFileDialog::QFileDialog ( const <a href="qstring.html">QString</a> & dirName, const <a href="qstring.html">QString</a> & filter = QString::null, <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, bool modal = FALSE )
|
---|
| 302 | </h3>
|
---|
| 303 | Constructs a file dialog called <em>name</em> with the parent, <em>parent</em>.
|
---|
| 304 | If <em>modal</em> is TRUE then the file dialog is modal; otherwise it is
|
---|
| 305 | modeless.
|
---|
| 306 | <p> If <em>dirName</em> is specified then it will be used as the dialog's
|
---|
| 307 | working directory, i.e. it will be the directory that is shown when
|
---|
| 308 | the dialog appears. If <em>filter</em> is specified it will be used as the
|
---|
| 309 | dialog's file filter.
|
---|
| 310 | <p>
|
---|
| 311 | <h3 class=fn><a name="QFileDialog-2"></a>QFileDialog::QFileDialog ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, bool modal = FALSE )
|
---|
| 312 | </h3>
|
---|
| 313 | Constructs a file dialog called <em>name</em>, with the parent, <em>parent</em>.
|
---|
| 314 | If <em>modal</em> is TRUE then the file dialog is modal; otherwise it is
|
---|
| 315 | modeless.
|
---|
| 316 |
|
---|
| 317 | <h3 class=fn><a name="~QFileDialog"></a>QFileDialog::~QFileDialog ()
|
---|
| 318 | </h3>
|
---|
| 319 | Destroys the file dialog.
|
---|
| 320 |
|
---|
| 321 | <h3 class=fn>void <a name="addFilter"></a>QFileDialog::addFilter ( const <a href="qstring.html">QString</a> & filter )
|
---|
| 322 | </h3>
|
---|
| 323 | Adds the filter <em>filter</em> to the list of filters and makes it the
|
---|
| 324 | current filter.
|
---|
| 325 | <p> <pre>
|
---|
| 326 | QFileDialog* fd = new QFileDialog( this );
|
---|
| 327 | fd-><a href="#addFilter">addFilter</a>( "Images (*.png *.jpg *.xpm)" );
|
---|
| 328 | fd-><a href="qdialog.html#show">show</a>();
|
---|
| 329 | </pre>
|
---|
| 330 |
|
---|
| 331 | <p> In the above example, a file dialog is created, and the file filter "Images
|
---|
| 332 | (*.png *.jpg *.xpm)" is added and is set as the current filter. The original
|
---|
| 333 | filter, "All Files (*)", is still available.
|
---|
| 334 | <p> <p>See also <a href="#setFilter">setFilter</a>() and <a href="#setFilters">setFilters</a>().
|
---|
| 335 |
|
---|
| 336 | <h3 class=fn>void <a name="addLeftWidget"></a>QFileDialog::addLeftWidget ( <a href="qwidget.html">QWidget</a> * w )<tt> [protected]</tt>
|
---|
| 337 | </h3>
|
---|
| 338 | Adds the widget <em>w</em> to the left-hand side of the file dialog.
|
---|
| 339 | <p> <p>See also <a href="#addRightWidget">addRightWidget</a>(), <a href="#addWidgets">addWidgets</a>(), and <a href="#addToolButton">addToolButton</a>().
|
---|
| 340 |
|
---|
| 341 | <h3 class=fn>void <a name="addRightWidget"></a>QFileDialog::addRightWidget ( <a href="qwidget.html">QWidget</a> * w )<tt> [protected]</tt>
|
---|
| 342 | </h3>
|
---|
| 343 | Adds the widget <em>w</em> to the right-hand side of the file dialog.
|
---|
| 344 | <p> <p>See also <a href="#addLeftWidget">addLeftWidget</a>(), <a href="#addWidgets">addWidgets</a>(), and <a href="#addToolButton">addToolButton</a>().
|
---|
| 345 |
|
---|
| 346 | <h3 class=fn>void <a name="addToolButton"></a>QFileDialog::addToolButton ( <a href="qbutton.html">QButton</a> * b, bool separator = FALSE )<tt> [protected]</tt>
|
---|
| 347 | </h3>
|
---|
| 348 | Adds the tool button <em>b</em> to the row of tool buttons at the top of the
|
---|
| 349 | file dialog. The button is appended to the right of
|
---|
| 350 | this row. If <em>separator</em> is TRUE, a small space is inserted between the
|
---|
| 351 | last button of the row and the new button <em>b</em>.
|
---|
| 352 | <p> <p>See also <a href="#addWidgets">addWidgets</a>(), <a href="#addLeftWidget">addLeftWidget</a>(), and <a href="#addRightWidget">addRightWidget</a>().
|
---|
| 353 |
|
---|
| 354 | <h3 class=fn>void <a name="addWidgets"></a>QFileDialog::addWidgets ( <a href="qlabel.html">QLabel</a> * l, <a href="qwidget.html">QWidget</a> * w, <a href="qpushbutton.html">QPushButton</a> * b )<tt> [protected]</tt>
|
---|
| 355 | </h3>
|
---|
| 356 | Adds the specified widgets to the bottom of the file dialog. The
|
---|
| 357 | label <em>l</em> is placed underneath the "file name" and the "file types"
|
---|
| 358 | labels. The widget <em>w</em> is placed underneath the file types combobox.
|
---|
| 359 | The button <em>b</em> is placed underneath the Cancel pushbutton.
|
---|
| 360 | <p> <pre>
|
---|
| 361 | MyFileDialog::MyFileDialog( <a href="qwidget.html">QWidget</a>* parent, const char* name ) :
|
---|
| 362 | <a href="#QFileDialog">QFileDialog</a>( parent, name )
|
---|
| 363 | {
|
---|
| 364 | <a href="qlabel.html">QLabel</a>* label = new <a href="qlabel.html">QLabel</a>( "Added widgets", this );
|
---|
| 365 | <a href="qlineedit.html">QLineEdit</a>* lineedit = new <a href="qlineedit.html">QLineEdit</a>( this );
|
---|
| 366 | <a href="qpushbutton.html">QPushButton</a>* pushbutton = new <a href="qpushbutton.html">QPushButton</a>( this );
|
---|
| 367 |
|
---|
| 368 | <a href="#addWidgets">addWidgets</a>( label, lineedit, pushbutton );
|
---|
| 369 | }
|
---|
| 370 | </pre>
|
---|
| 371 |
|
---|
| 372 | <p> If you don't want to have one of the widgets added, pass 0 in that
|
---|
| 373 | widget's position.
|
---|
| 374 | <p> Every time you call this function, a new row of widgets will be added
|
---|
| 375 | to the bottom of the file dialog.
|
---|
| 376 | <p> <p>See also <a href="#addToolButton">addToolButton</a>(), <a href="#addLeftWidget">addLeftWidget</a>(), and <a href="#addRightWidget">addRightWidget</a>().
|
---|
| 377 |
|
---|
| 378 | <h3 class=fn>const <a href="qdir.html">QDir</a> * <a name="dir"></a>QFileDialog::dir () const
|
---|
| 379 | </h3>
|
---|
| 380 | Returns the current directory shown in the file dialog.
|
---|
| 381 | <p> The ownership of the <a href="qdir.html">QDir</a> pointer is transferred to the caller, so
|
---|
| 382 | it must be deleted by the caller when no longer required.
|
---|
| 383 | <p> <p>See also <a href="#setDir">setDir</a>().
|
---|
| 384 |
|
---|
| 385 | <h3 class=fn>void <a name="dirEntered"></a>QFileDialog::dirEntered ( const <a href="qstring.html">QString</a> & )<tt> [signal]</tt>
|
---|
| 386 | </h3>
|
---|
| 387 |
|
---|
| 388 | <p> This signal is emitted when the user enters a directory.
|
---|
| 389 | <p> <p>See also <a href="#dir">dir</a>().
|
---|
| 390 |
|
---|
| 391 | <h3 class=fn><a href="qstring.html">QString</a> <a name="dirPath"></a>QFileDialog::dirPath () const
|
---|
| 392 | </h3><p>Returns the file dialog's working directory.
|
---|
| 393 | See the <a href="qfiledialog.html#dirPath-prop">"dirPath"</a> property for details.
|
---|
| 394 | <h3 class=fn>void <a name="fileHighlighted"></a>QFileDialog::fileHighlighted ( const <a href="qstring.html">QString</a> & )<tt> [signal]</tt>
|
---|
| 395 | </h3>
|
---|
| 396 |
|
---|
| 397 | <p> This signal is emitted when the user highlights a file, i.e. makes
|
---|
| 398 | it the current file.
|
---|
| 399 | <p> <p>See also <a href="#fileSelected">fileSelected</a>() and <a href="#filesSelected">filesSelected</a>().
|
---|
| 400 |
|
---|
| 401 | <h3 class=fn>void <a name="fileSelected"></a>QFileDialog::fileSelected ( const <a href="qstring.html">QString</a> & )<tt> [signal]</tt>
|
---|
| 402 | </h3>
|
---|
| 403 |
|
---|
| 404 | <p> This signal is emitted when the user selects a file.
|
---|
| 405 | <p> <p>See also <a href="#filesSelected">filesSelected</a>(), <a href="#fileHighlighted">fileHighlighted</a>(), and <a href="#selectedFile-prop">selectedFile</a>.
|
---|
| 406 |
|
---|
| 407 | <h3 class=fn>void <a name="filesSelected"></a>QFileDialog::filesSelected ( const <a href="qstringlist.html">QStringList</a> & )<tt> [signal]</tt>
|
---|
| 408 | </h3>
|
---|
| 409 |
|
---|
| 410 | <p> This signal is emitted when the user selects one or more files in <em>ExistingFiles</em> mode.
|
---|
| 411 | <p> <p>See also <a href="#fileSelected">fileSelected</a>(), <a href="#fileHighlighted">fileHighlighted</a>(), and <a href="#selectedFiles-prop">selectedFiles</a>.
|
---|
| 412 |
|
---|
| 413 | <h3 class=fn>void <a name="filterSelected"></a>QFileDialog::filterSelected ( const <a href="qstring.html">QString</a> & )<tt> [signal]</tt>
|
---|
| 414 | </h3>
|
---|
| 415 |
|
---|
| 416 | <p> This signal is emitted when the user selects a filter.
|
---|
| 417 | <p> <p>See also <a href="#selectedFilter-prop">selectedFilter</a>.
|
---|
| 418 |
|
---|
| 419 | <h3 class=fn><a href="qstring.html">QString</a> <a name="getExistingDirectory"></a>QFileDialog::getExistingDirectory ( const <a href="qstring.html">QString</a> & dir = QString::null, <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, const <a href="qstring.html">QString</a> & caption = QString::null, bool dirOnly = TRUE, bool resolveSymlinks = TRUE )<tt> [static]</tt>
|
---|
| 420 | </h3>
|
---|
| 421 | This is a convenience static function that will return an existing directory
|
---|
| 422 | selected by the user.
|
---|
| 423 | <p> <pre>
|
---|
| 424 | <a href="qstring.html">QString</a> s = QFileDialog::<a href="#getExistingDirectory">getExistingDirectory</a>(
|
---|
| 425 | "/home",
|
---|
| 426 | this,
|
---|
| 427 | "get existing directory",
|
---|
| 428 | "Choose a directory",
|
---|
| 429 | TRUE );
|
---|
| 430 | </pre>
|
---|
| 431 |
|
---|
| 432 | <p> This function creates a modal file dialog called <em>name</em>, with
|
---|
| 433 | parent, <em>parent</em>. If parent is not 0, the dialog will be shown
|
---|
| 434 | centered over the parent.
|
---|
| 435 | <p> The dialog's working directory is set to <em>dir</em>, and the caption is
|
---|
| 436 | set to <em>caption</em>. Either of these may be <a href="qstring.html#QString-null">QString::null</a> in which case
|
---|
| 437 | the current directory and a default caption will be used respectively.
|
---|
| 438 | <p> Note on Windows that if <em>dir</em> is QString::null then the dialog's working
|
---|
| 439 | directory will be set to the user's My Documents directory.
|
---|
| 440 | <p> If <em>dirOnly</em> is TRUE, then only directories will be shown in
|
---|
| 441 | the file dialog; otherwise both directories and files will be shown.
|
---|
| 442 | <p> Under Unix/X11, the normal behavior of the file dialog is to resolve
|
---|
| 443 | and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
|
---|
| 444 | the file dialog will change to /var/tmp after entering /usr/tmp.
|
---|
| 445 | If <em>resolveSymlinks</em> is FALSE, the file dialog will treat
|
---|
| 446 | symlinks as regular directories.
|
---|
| 447 | <p> Under Windows and Mac OS X, this static function will use the native
|
---|
| 448 | file dialog and not a QFileDialog, unless the style of the application
|
---|
| 449 | is set to something other than the native style. (Note that on Windows the
|
---|
| 450 | dialog will spin a blocking modal event loop that will not dispatch any
|
---|
| 451 | QTimers and if parent is not 0 then it will position the dialog just under
|
---|
| 452 | the parent's titlebar).
|
---|
| 453 | <p> <p>See also <a href="#getOpenFileName">getOpenFileName</a>(), <a href="#getOpenFileNames">getOpenFileNames</a>(), and <a href="#getSaveFileName">getSaveFileName</a>().
|
---|
| 454 |
|
---|
| 455 | <h3 class=fn><a href="qstring.html">QString</a> <a name="getOpenFileName"></a>QFileDialog::getOpenFileName ( const <a href="qstring.html">QString</a> & startWith = QString::null, const <a href="qstring.html">QString</a> & filter = QString::null, <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, const <a href="qstring.html">QString</a> & caption = QString::null, <a href="qstring.html">QString</a> * selectedFilter = 0, bool resolveSymlinks = TRUE )<tt> [static]</tt>
|
---|
| 456 | </h3>
|
---|
| 457 | This is a convenience static function that returns an existing file
|
---|
| 458 | selected by the user. If the user pressed Cancel, it returns a null
|
---|
| 459 | string.
|
---|
| 460 | <p> <pre>
|
---|
| 461 | <a href="qstring.html">QString</a> s = QFileDialog::<a href="#getOpenFileName">getOpenFileName</a>(
|
---|
| 462 | "/home",
|
---|
| 463 | "Images (*.png *.xpm *.jpg)",
|
---|
| 464 | this,
|
---|
| 465 | "open file dialog",
|
---|
| 466 | "Choose a file to open" );
|
---|
| 467 | </pre>
|
---|
| 468 |
|
---|
| 469 | <p> The function creates a modal file dialog called <em>name</em>, with
|
---|
| 470 | parent, <em>parent</em>. If a parent is not 0, the dialog will be shown
|
---|
| 471 | centered over the parent.
|
---|
| 472 | <p> The file dialog's working directory will be set to <em>startWith</em>. If <em>startWith</em> includes a file name, the file will be selected. The filter
|
---|
| 473 | is set to <em>filter</em> so that only those files which match the filter
|
---|
| 474 | are shown. The filter selected is set to <em>selectedFilter</em>. The parameters
|
---|
| 475 | <em>startWith</em>, <em>selectedFilter</em> and <em>filter</em> may be <a href="qstring.html#QString-null">QString::null</a>.
|
---|
| 476 | <p> The dialog's caption is set to <em>caption</em>. If <em>caption</em> is not
|
---|
| 477 | specified then a default caption will be used.
|
---|
| 478 | <p> Under Windows and Mac OS X, this static function will use the native
|
---|
| 479 | file dialog and not a QFileDialog, unless the style of the application
|
---|
| 480 | is set to something other than the native style (Note that on Windows the
|
---|
| 481 | dialog will spin a blocking modal event loop that will not dispatch any
|
---|
| 482 | QTimers and if parent is not 0 then it will position the dialog just under
|
---|
| 483 | the parent's titlebar).
|
---|
| 484 | <p> Under Unix/X11, the normal behavior of the file dialog is to resolve
|
---|
| 485 | and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
|
---|
| 486 | the file dialog will change to /var/tmp after entering /usr/tmp.
|
---|
| 487 | If <em>resolveSymlinks</em> is FALSE, the file dialog will treat
|
---|
| 488 | symlinks as regular directories.
|
---|
| 489 | <p> <p>See also <a href="#getOpenFileNames">getOpenFileNames</a>(), <a href="#getSaveFileName">getSaveFileName</a>(), and <a href="#getExistingDirectory">getExistingDirectory</a>().
|
---|
| 490 |
|
---|
| 491 | <p>Examples: <a href="qaction-application-example.html#x1132">action/application.cpp</a>, <a href="addressbook-example.html#x567">addressbook/mainwindow.cpp</a>, <a href="simple-application-example.html#x1549">application/application.cpp</a>, <a href="distributor-example.html#x2660">distributor/distributor.ui.h</a>, <a href="ftpclient-example.html#x741">network/ftpclient/ftpmainwindow.ui.h</a>, <a href="qwerty-example.html#x365">qwerty/qwerty.cpp</a>, and <a href="showimg-example.html#x1318">showimg/showimg.cpp</a>.
|
---|
| 492 | <h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="getOpenFileNames"></a>QFileDialog::getOpenFileNames ( const <a href="qstring.html">QString</a> & filter = QString::null, const <a href="qstring.html">QString</a> & dir = QString::null, <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, const <a href="qstring.html">QString</a> & caption = QString::null, <a href="qstring.html">QString</a> * selectedFilter = 0, bool resolveSymlinks = TRUE )<tt> [static]</tt>
|
---|
| 493 | </h3>
|
---|
| 494 | This is a convenience static function that will return one or more
|
---|
| 495 | existing files selected by the user.
|
---|
| 496 | <p> <pre>
|
---|
| 497 | <a href="qstringlist.html">QStringList</a> files = QFileDialog::<a href="#getOpenFileNames">getOpenFileNames</a>(
|
---|
| 498 | "Images (*.png *.xpm *.jpg)",
|
---|
| 499 | "/home",
|
---|
| 500 | this,
|
---|
| 501 | "open files dialog",
|
---|
| 502 | "Select one or more files to open" );
|
---|
| 503 | </pre>
|
---|
| 504 |
|
---|
| 505 | <p> This function creates a modal file dialog called <em>name</em>, with
|
---|
| 506 | parent <em>parent</em>. If <em>parent</em> is not 0, the dialog will be shown
|
---|
| 507 | centered over the parent.
|
---|
| 508 | <p> The file dialog's working directory will be set to <em>dir</em>. If <em>dir</em> includes a file name, the file will be selected. The filter
|
---|
| 509 | is set to <em>filter</em> so that only those files which match the filter
|
---|
| 510 | are shown. The filter selected is set to <em>selectedFilter</em>. The parameters
|
---|
| 511 | <em>dir</em>, <em>selectedFilter</em> and <em>filter</em> may be <a href="qstring.html#QString-null">QString::null</a>.
|
---|
| 512 | <p> The dialog's caption is set to <em>caption</em>. If <em>caption</em> is not
|
---|
| 513 | specified then a default caption will be used.
|
---|
| 514 | <p> Under Windows and Mac OS X, this static function will use the native
|
---|
| 515 | file dialog and not a QFileDialog, unless the style of the application
|
---|
| 516 | is set to something other than the native style. (Note that on Windows the
|
---|
| 517 | dialog will spin a blocking modal event loop that will not dispatch any
|
---|
| 518 | QTimers and if parent is not 0 then it will position the dialog just under
|
---|
| 519 | the parent's titlebar).
|
---|
| 520 | <p> Under Unix/X11, the normal behavior of the file dialog is to resolve
|
---|
| 521 | and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
|
---|
| 522 | the file dialog will change to /var/tmp after entering /usr/tmp.
|
---|
| 523 | If <em>resolveSymlinks</em> is FALSE, the file dialog will treat
|
---|
| 524 | symlinks as regular directories.
|
---|
| 525 | <p> Note that if you want to iterate over the list of files, you should
|
---|
| 526 | iterate over a copy, e.g.
|
---|
| 527 | <pre>
|
---|
| 528 | <a href="qstringlist.html">QStringList</a> list = files;
|
---|
| 529 | QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
|
---|
| 530 | while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
|
---|
| 531 | myProcessing( *it );
|
---|
| 532 | ++it;
|
---|
| 533 | }
|
---|
| 534 | </pre>
|
---|
| 535 |
|
---|
| 536 | <p> <p>See also <a href="#getOpenFileName">getOpenFileName</a>(), <a href="#getSaveFileName">getSaveFileName</a>(), and <a href="#getExistingDirectory">getExistingDirectory</a>().
|
---|
| 537 |
|
---|
| 538 | <h3 class=fn><a href="qstring.html">QString</a> <a name="getSaveFileName"></a>QFileDialog::getSaveFileName ( const <a href="qstring.html">QString</a> & startWith = QString::null, const <a href="qstring.html">QString</a> & filter = QString::null, <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, const <a href="qstring.html">QString</a> & caption = QString::null, <a href="qstring.html">QString</a> * selectedFilter = 0, bool resolveSymlinks = TRUE )<tt> [static]</tt>
|
---|
| 539 | </h3>
|
---|
| 540 | This is a convenience static function that will return a file name
|
---|
| 541 | selected by the user. The file does not have to exist.
|
---|
| 542 | <p> It creates a modal file dialog called <em>name</em>, with parent, <em>parent</em>.
|
---|
| 543 | If a parent is not 0, the dialog will be shown centered over the
|
---|
| 544 | parent.
|
---|
| 545 | <p> <pre>
|
---|
| 546 | <a href="qstring.html">QString</a> s = QFileDialog::<a href="#getSaveFileName">getSaveFileName</a>(
|
---|
| 547 | "/home",
|
---|
| 548 | "Images (*.png *.xpm *.jpg)",
|
---|
| 549 | this,
|
---|
| 550 | "save file dialog",
|
---|
| 551 | "Choose a filename to save under" );
|
---|
| 552 | </pre>
|
---|
| 553 |
|
---|
| 554 | <p> The file dialog's working directory will be set to <em>startWith</em>. If <em>startWith</em> includes a file name, the file will be selected. The filter
|
---|
| 555 | is set to <em>filter</em> so that only those files which match the filter
|
---|
| 556 | are shown. The filter selected is set to <em>selectedFilter</em>. The parameters
|
---|
| 557 | <em>startWith</em>, <em>selectedFilter</em> and <em>filter</em> may be <a href="qstring.html#QString-null">QString::null</a>.
|
---|
| 558 | <p> The dialog's caption is set to <em>caption</em>. If <em>caption</em> is not
|
---|
| 559 | specified then a default caption will be used.
|
---|
| 560 | <p> Under Windows and Mac OS X, this static function will use the native
|
---|
| 561 | file dialog and not a QFileDialog, unless the style of the application
|
---|
| 562 | is set to something other than the native style. (Note that on Windows the
|
---|
| 563 | dialog will spin a blocking modal event loop that will not dispatch any
|
---|
| 564 | QTimers and if parent is not 0 then it will position the dialog just under
|
---|
| 565 | the parent's titlebar.
|
---|
| 566 | <p> Under Unix/X11, the normal behavior of the file dialog is to resolve
|
---|
| 567 | and follow symlinks. For example, if /usr/tmp is a symlink to /var/tmp,
|
---|
| 568 | the file dialog will change to /var/tmp after entering /usr/tmp.
|
---|
| 569 | If <em>resolveSymlinks</em> is FALSE, the file dialog will treat
|
---|
| 570 | symlinks as regular directories.
|
---|
| 571 | <p> <p>See also <a href="#getOpenFileName">getOpenFileName</a>(), <a href="#getOpenFileNames">getOpenFileNames</a>(), and <a href="#getExistingDirectory">getExistingDirectory</a>().
|
---|
| 572 |
|
---|
| 573 | <p>Examples: <a href="qaction-application-example.html#x1133">action/application.cpp</a>, <a href="addressbook-example.html#x568">addressbook/mainwindow.cpp</a>, <a href="simple-application-example.html#x1550">application/application.cpp</a>, <a href="ftpclient-example.html#x742">network/ftpclient/ftpmainwindow.ui.h</a>, <a href="qmag-example.html#x1775">qmag/qmag.cpp</a>, <a href="qwerty-example.html#x366">qwerty/qwerty.cpp</a>, and <a href="showimg-example.html#x1319">showimg/showimg.cpp</a>.
|
---|
| 574 | <h3 class=fn><a href="qfileiconprovider.html">QFileIconProvider</a> * <a name="iconProvider"></a>QFileDialog::iconProvider ()<tt> [static]</tt>
|
---|
| 575 | </h3>
|
---|
| 576 | Returns a pointer to the icon provider currently set on the file dialog.
|
---|
| 577 | By default there is no icon provider, and this function returns 0.
|
---|
| 578 | <p> <p>See also <a href="#setIconProvider">setIconProvider</a>() and <a href="qfileiconprovider.html">QFileIconProvider</a>.
|
---|
| 579 |
|
---|
| 580 | <h3 class=fn>bool <a name="isContentsPreviewEnabled"></a>QFileDialog::isContentsPreviewEnabled () const
|
---|
| 581 | </h3><p>Returns TRUE if the file dialog can provide a contents preview of the currently selected file; otherwise returns FALSE.
|
---|
| 582 | See the <a href="qfiledialog.html#contentsPreview-prop">"contentsPreview"</a> property for details.
|
---|
| 583 | <h3 class=fn>bool <a name="isInfoPreviewEnabled"></a>QFileDialog::isInfoPreviewEnabled () const
|
---|
| 584 | </h3><p>Returns TRUE if the file dialog can provide preview information about the currently selected file; otherwise returns FALSE.
|
---|
| 585 | See the <a href="qfiledialog.html#infoPreview-prop">"infoPreview"</a> property for details.
|
---|
| 586 | <h3 class=fn><a href="qfiledialog.html#Mode-enum">Mode</a> <a name="mode"></a>QFileDialog::mode () const
|
---|
| 587 | </h3><p>Returns the file dialog's mode.
|
---|
| 588 | See the <a href="qfiledialog.html#mode-prop">"mode"</a> property for details.
|
---|
| 589 | <h3 class=fn><a href="qfiledialog.html#PreviewMode-enum">PreviewMode</a> <a name="previewMode"></a>QFileDialog::previewMode () const
|
---|
| 590 | </h3><p>Returns the preview mode for the file dialog.
|
---|
| 591 | See the <a href="qfiledialog.html#previewMode-prop">"previewMode"</a> property for details.
|
---|
| 592 | <h3 class=fn>void <a name="rereadDir"></a>QFileDialog::rereadDir ()
|
---|
| 593 | </h3>
|
---|
| 594 | Rereads the current directory shown in the file dialog.
|
---|
| 595 | <p> The only time you will need to call this function is if the contents of
|
---|
| 596 | the directory change and you wish to refresh the file dialog to reflect
|
---|
| 597 | the change.
|
---|
| 598 | <p> <p>See also <a href="#resortDir">resortDir</a>().
|
---|
| 599 |
|
---|
| 600 | <h3 class=fn>void <a name="resortDir"></a>QFileDialog::resortDir ()
|
---|
| 601 | </h3>
|
---|
| 602 | Re-sorts the displayed directory.
|
---|
| 603 | <p> <p>See also <a href="#rereadDir">rereadDir</a>().
|
---|
| 604 |
|
---|
| 605 | <h3 class=fn>void <a name="selectAll"></a>QFileDialog::selectAll ( bool b )
|
---|
| 606 | </h3>
|
---|
| 607 | If <em>b</em> is TRUE then all the files in the current directory are selected;
|
---|
| 608 | otherwise, they are deselected.
|
---|
| 609 |
|
---|
| 610 | <h3 class=fn><a href="qstring.html">QString</a> <a name="selectedFile"></a>QFileDialog::selectedFile () const
|
---|
| 611 | </h3><p>Returns the name of the selected file.
|
---|
| 612 | See the <a href="qfiledialog.html#selectedFile-prop">"selectedFile"</a> property for details.
|
---|
| 613 | <h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="selectedFiles"></a>QFileDialog::selectedFiles () const
|
---|
| 614 | </h3><p>Returns the list of selected files.
|
---|
| 615 | See the <a href="qfiledialog.html#selectedFiles-prop">"selectedFiles"</a> property for details.
|
---|
| 616 | <h3 class=fn><a href="qstring.html">QString</a> <a name="selectedFilter"></a>QFileDialog::selectedFilter () const
|
---|
| 617 | </h3><p>Returns the filter which the user has selected in the file dialog.
|
---|
| 618 | See the <a href="qfiledialog.html#selectedFilter-prop">"selectedFilter"</a> property for details.
|
---|
| 619 | <h3 class=fn>void <a name="setContentsPreview"></a>QFileDialog::setContentsPreview ( <a href="qwidget.html">QWidget</a> * w, <a href="qfilepreview.html">QFilePreview</a> * preview )
|
---|
| 620 | </h3>
|
---|
| 621 | Sets the widget to be used for displaying the contents of the file
|
---|
| 622 | to the widget <em>w</em> and a preview of those contents to the
|
---|
| 623 | <a href="qfilepreview.html">QFilePreview</a> <em>preview</em>.
|
---|
| 624 | <p> Normally you would create a preview widget that derives from both <a href="qwidget.html">QWidget</a> and
|
---|
| 625 | QFilePreview, so you should pass the same widget twice. If you
|
---|
| 626 | don't, you must remember to delete the preview object in order to
|
---|
| 627 | avoid memory leaks.
|
---|
| 628 | <p> <pre>
|
---|
| 629 | class Preview : public <a href="qlabel.html">QLabel</a>, public QFilePreview
|
---|
| 630 | {
|
---|
| 631 | public:
|
---|
| 632 | Preview( <a href="qwidget.html">QWidget</a> *parent=0 ) : <a href="qlabel.html">QLabel</a>( parent ) {}
|
---|
| 633 |
|
---|
| 634 | void previewUrl( const <a href="qurl.html">QUrl</a> &u )
|
---|
| 635 | {
|
---|
| 636 | <a href="qstring.html">QString</a> path = u.<a href="qurl.html#path">path</a>();
|
---|
| 637 | <a href="qpixmap.html">QPixmap</a> pix( path );
|
---|
| 638 | if ( pix.<a href="qpixmap.html#isNull">isNull</a>() )
|
---|
| 639 | setText( "This is not a pixmap" );
|
---|
| 640 | else
|
---|
| 641 | setPixmap( pix );
|
---|
| 642 | }
|
---|
| 643 | };
|
---|
| 644 |
|
---|
| 645 | //...
|
---|
| 646 |
|
---|
| 647 | int main( int argc, char** argv )
|
---|
| 648 | {
|
---|
| 649 | Preview* p = new Preview;
|
---|
| 650 |
|
---|
| 651 | QFileDialog* fd = new QFileDialog( this );
|
---|
| 652 | fd-><a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE );
|
---|
| 653 | fd-><a href="#setContentsPreview">setContentsPreview</a>( p, p );
|
---|
| 654 | fd-><a href="#setPreviewMode">setPreviewMode</a>( QFileDialog::<a href="#PreviewMode-enum">Contents</a> );
|
---|
| 655 | fd-><a href="qdialog.html#show">show</a>();
|
---|
| 656 | }
|
---|
| 657 | </pre>
|
---|
| 658 |
|
---|
| 659 | <p> <p>See also <a href="#contentsPreview-prop">contentsPreview</a>, <a href="#setInfoPreview">setInfoPreview</a>(), and <a href="#previewMode-prop">previewMode</a>.
|
---|
| 660 |
|
---|
| 661 | <p>Example: <a href="qdir-example.html#x1817">qdir/qdir.cpp</a>.
|
---|
| 662 | <h3 class=fn>void <a name="setContentsPreviewEnabled"></a>QFileDialog::setContentsPreviewEnabled ( bool )
|
---|
| 663 | </h3><p>Sets whether the file dialog can provide a contents preview of the currently selected file.
|
---|
| 664 | See the <a href="qfiledialog.html#contentsPreview-prop">"contentsPreview"</a> property for details.
|
---|
| 665 | <h3 class=fn>void <a name="setDir"></a>QFileDialog::setDir ( const <a href="qdir.html">QDir</a> & dir )
|
---|
| 666 | </h3>
|
---|
| 667 | Sets the file dialog's working directory to <em>dir</em>.
|
---|
| 668 | <p>See also <a href="#dir">dir</a>().
|
---|
| 669 |
|
---|
| 670 | <h3 class=fn>void <a name="setDir-2"></a>QFileDialog::setDir ( const <a href="qstring.html">QString</a> & pathstr )<tt> [slot]</tt>
|
---|
| 671 | </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 672 | <p> Sets the file dialog's working directory to <em>pathstr</em>.
|
---|
| 673 | <p> <p>See also <a href="#dir">dir</a>().
|
---|
| 674 |
|
---|
| 675 | <h3 class=fn>void <a name="setFilter"></a>QFileDialog::setFilter ( const <a href="qstring.html">QString</a> & newFilter )<tt> [slot]</tt>
|
---|
| 676 | </h3>
|
---|
| 677 | <p> Sets the filter used in the file dialog to <em>newFilter</em>.
|
---|
| 678 | <p> If <em>newFilter</em> contains a pair of parentheses containing one or more
|
---|
| 679 | of <em><b>anything*something</b></em> separated by spaces or by
|
---|
| 680 | semi-colons then only the text contained in the parentheses is used as
|
---|
| 681 | the filter. This means that these calls are all equivalent:
|
---|
| 682 | <p> <pre>
|
---|
| 683 | fd->setFilter( "All C++ files (*.cpp *.cc *.C *.cxx *.c++)" );
|
---|
| 684 | fd->setFilter( "*.cpp *.cc *.C *.cxx *.c++" );
|
---|
| 685 | fd->setFilter( "All C++ files (*.cpp;*.cc;*.C;*.cxx;*.c++)" );
|
---|
| 686 | fd->setFilter( "*.cpp;*.cc;*.C;*.cxx;*.c++" );
|
---|
| 687 | </pre>
|
---|
| 688 |
|
---|
| 689 | <p> <p>See also <a href="#setFilters">setFilters</a>().
|
---|
| 690 |
|
---|
| 691 | <h3 class=fn>void <a name="setFilters"></a>QFileDialog::setFilters ( const <a href="qstring.html">QString</a> & filters )<tt> [slot]</tt>
|
---|
| 692 | </h3>
|
---|
| 693 | Sets the filters used in the file dialog to <em>filters</em>. Each group
|
---|
| 694 | of filters must be separated by <tt>;;</tt> (<em>two</em> semi-colons).
|
---|
| 695 | <p> <pre>
|
---|
| 696 | <a href="qstring.html">QString</a> types("Image files (*.png *.xpm *.jpg);;"
|
---|
| 697 | "Text files (*.txt);;"
|
---|
| 698 | "Any files (*)");
|
---|
| 699 | QFileDialog fd = new QFileDialog( this );
|
---|
| 700 | fd-><a href="#setFilters">setFilters</a>( types );
|
---|
| 701 | fd-><a href="qdialog.html#show">show</a>();
|
---|
| 702 | </pre>
|
---|
| 703 |
|
---|
| 704 | <p>
|
---|
| 705 | <h3 class=fn>void <a name="setFilters-2"></a>QFileDialog::setFilters ( const char ** types )<tt> [slot]</tt>
|
---|
| 706 | </h3>
|
---|
| 707 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 708 | <p> <em>types</em> must be a null-terminated list of strings.
|
---|
| 709 | <p>
|
---|
| 710 | <h3 class=fn>void <a name="setFilters-3"></a>QFileDialog::setFilters ( const <a href="qstringlist.html">QStringList</a> & )<tt> [slot]</tt>
|
---|
| 711 | </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 712 | <p>
|
---|
| 713 | <h3 class=fn>void <a name="setIconProvider"></a>QFileDialog::setIconProvider ( <a href="qfileiconprovider.html">QFileIconProvider</a> * provider )<tt> [static]</tt>
|
---|
| 714 | </h3>
|
---|
| 715 | Sets the <a href="qfileiconprovider.html">QFileIconProvider</a> used by the file dialog to <em>provider</em>.
|
---|
| 716 | <p> The default is that there is no QFileIconProvider and QFileDialog
|
---|
| 717 | just draws a folder icon next to each directory and nothing next
|
---|
| 718 | to files.
|
---|
| 719 | <p> <p>See also <a href="qfileiconprovider.html">QFileIconProvider</a> and <a href="#iconProvider">iconProvider</a>().
|
---|
| 720 |
|
---|
| 721 | <p>Example: <a href="showimg-example.html#x1362">showimg/main.cpp</a>.
|
---|
| 722 | <h3 class=fn>void <a name="setInfoPreview"></a>QFileDialog::setInfoPreview ( <a href="qwidget.html">QWidget</a> * w, <a href="qfilepreview.html">QFilePreview</a> * preview )
|
---|
| 723 | </h3>
|
---|
| 724 | Sets the widget to be used for displaying information about the file
|
---|
| 725 | to the widget <em>w</em> and a preview of that information to the
|
---|
| 726 | <a href="qfilepreview.html">QFilePreview</a> <em>preview</em>.
|
---|
| 727 | <p> Normally you would create a preview widget that derives from both <a href="qwidget.html">QWidget</a> and
|
---|
| 728 | QFilePreview, so you should pass the same widget twice. If you
|
---|
| 729 | don't, you must remember to delete the preview object in order to
|
---|
| 730 | avoid memory leaks.
|
---|
| 731 | <p> <pre>
|
---|
| 732 | class Preview : public <a href="qlabel.html">QLabel</a>, public QFilePreview
|
---|
| 733 | {
|
---|
| 734 | public:
|
---|
| 735 | Preview( <a href="qwidget.html">QWidget</a> *parent=0 ) : <a href="qlabel.html">QLabel</a>( parent ) {}
|
---|
| 736 |
|
---|
| 737 | void previewUrl( const <a href="qurl.html">QUrl</a> &u )
|
---|
| 738 | {
|
---|
| 739 | <a href="qstring.html">QString</a> path = u.<a href="qurl.html#path">path</a>();
|
---|
| 740 | <a href="qpixmap.html">QPixmap</a> pix( path );
|
---|
| 741 | if ( pix.<a href="qpixmap.html#isNull">isNull</a>() )
|
---|
| 742 | setText( "This is not a pixmap" );
|
---|
| 743 | else
|
---|
| 744 | setText( "This is a pixmap" );
|
---|
| 745 | }
|
---|
| 746 | };
|
---|
| 747 |
|
---|
| 748 | //...
|
---|
| 749 |
|
---|
| 750 | int main( int argc, char** argv )
|
---|
| 751 | {
|
---|
| 752 | Preview* p = new Preview;
|
---|
| 753 |
|
---|
| 754 | QFileDialog* fd = new QFileDialog( this );
|
---|
| 755 | fd-><a href="#setInfoPreviewEnabled">setInfoPreviewEnabled</a>( TRUE );
|
---|
| 756 | fd-><a href="#setInfoPreview">setInfoPreview</a>( p, p );
|
---|
| 757 | fd-><a href="#setPreviewMode">setPreviewMode</a>( QFileDialog::<a href="#PreviewMode-enum">Info</a> );
|
---|
| 758 | fd-><a href="qdialog.html#show">show</a>();
|
---|
| 759 | }
|
---|
| 760 |
|
---|
| 761 | </pre>
|
---|
| 762 |
|
---|
| 763 | <p> <p>See also <a href="#setContentsPreview">setContentsPreview</a>(), <a href="#infoPreview-prop">infoPreview</a>, and <a href="#previewMode-prop">previewMode</a>.
|
---|
| 764 |
|
---|
| 765 | <p>
|
---|
| 766 | <h3 class=fn>void <a name="setInfoPreviewEnabled"></a>QFileDialog::setInfoPreviewEnabled ( bool )
|
---|
| 767 | </h3><p>Sets whether the file dialog can provide preview information about the currently selected file.
|
---|
| 768 | See the <a href="qfiledialog.html#infoPreview-prop">"infoPreview"</a> property for details.
|
---|
| 769 | <h3 class=fn>void <a name="setMode"></a>QFileDialog::setMode ( <a href="qfiledialog.html#Mode-enum">Mode</a> )
|
---|
| 770 | </h3><p>Sets the file dialog's mode.
|
---|
| 771 | See the <a href="qfiledialog.html#mode-prop">"mode"</a> property for details.
|
---|
| 772 | <h3 class=fn>void <a name="setPreviewMode"></a>QFileDialog::setPreviewMode ( <a href="qfiledialog.html#PreviewMode-enum">PreviewMode</a> m )
|
---|
| 773 | </h3><p>Sets the preview mode for the file dialog to <em>m</em>.
|
---|
| 774 | See the <a href="qfiledialog.html#previewMode-prop">"previewMode"</a> property for details.
|
---|
| 775 | <h3 class=fn>void <a name="setSelectedFilter"></a>QFileDialog::setSelectedFilter ( const <a href="qstring.html">QString</a> & mask )<tt> [virtual]</tt>
|
---|
| 776 | </h3>
|
---|
| 777 | Sets the current filter selected in the file dialog to the first
|
---|
| 778 | one that contains the text <em>mask</em>.
|
---|
| 779 |
|
---|
| 780 | <h3 class=fn>void <a name="setSelectedFilter-2"></a>QFileDialog::setSelectedFilter ( int n )<tt> [virtual]</tt>
|
---|
| 781 | </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 782 | <p> Sets the current filter selected in the file dialog to the
|
---|
| 783 | <em>n</em>-th filter in the filter list.
|
---|
| 784 | <p> <p>See also <a href="#filterSelected">filterSelected</a>(), <a href="#selectedFilter-prop">selectedFilter</a>, <a href="#selectedFiles-prop">selectedFiles</a>, and <a href="#selectedFile-prop">selectedFile</a>.
|
---|
| 785 |
|
---|
| 786 | <h3 class=fn>void <a name="setSelection"></a>QFileDialog::setSelection ( const <a href="qstring.html">QString</a> & filename )
|
---|
| 787 | </h3>
|
---|
| 788 | Sets the default selection to <em>filename</em>. If <em>filename</em> is
|
---|
| 789 | absolute, <a href="#setDir">setDir</a>() is also called to set the file dialog's working
|
---|
| 790 | directory to the filename's directory.
|
---|
| 791 | <p>
|
---|
| 792 |
|
---|
| 793 | <p>Example: <a href="qdir-example.html#x1821">qdir/qdir.cpp</a>.
|
---|
| 794 | <h3 class=fn>void <a name="setShowHiddenFiles"></a>QFileDialog::setShowHiddenFiles ( bool s )
|
---|
| 795 | </h3><p>Sets whether hidden files are shown in the file dialog to <em>s</em>.
|
---|
| 796 | See the <a href="qfiledialog.html#showHiddenFiles-prop">"showHiddenFiles"</a> property for details.
|
---|
| 797 | <h3 class=fn>void <a name="setUrl"></a>QFileDialog::setUrl ( const <a href="qurloperator.html">QUrlOperator</a> & url )<tt> [slot]</tt>
|
---|
| 798 | </h3>
|
---|
| 799 | Sets the file dialog's working directory to the directory specified at <em>url</em>.
|
---|
| 800 | <p> <p>See also <a href="#url">url</a>().
|
---|
| 801 |
|
---|
| 802 | <h3 class=fn>void <a name="setViewMode"></a>QFileDialog::setViewMode ( <a href="qfiledialog.html#ViewMode-enum">ViewMode</a> m )
|
---|
| 803 | </h3><p>Sets the file dialog's view mode to <em>m</em>.
|
---|
| 804 | See the <a href="qfiledialog.html#viewMode-prop">"viewMode"</a> property for details.
|
---|
| 805 | <h3 class=fn>bool <a name="showHiddenFiles"></a>QFileDialog::showHiddenFiles () const
|
---|
| 806 | </h3><p>Returns TRUE if hidden files are shown in the file dialog; otherwise returns FALSE.
|
---|
| 807 | See the <a href="qfiledialog.html#showHiddenFiles-prop">"showHiddenFiles"</a> property for details.
|
---|
| 808 | <h3 class=fn><a href="qurl.html">QUrl</a> <a name="url"></a>QFileDialog::url () const
|
---|
| 809 | </h3>
|
---|
| 810 | Returns the URL of the current working directory in the file dialog.
|
---|
| 811 | <p> <p>See also <a href="#setUrl">setUrl</a>().
|
---|
| 812 |
|
---|
| 813 | <p>Example: <a href="qdialog.html#x2129">network/networkprotocol/view.cpp</a>.
|
---|
| 814 | <h3 class=fn><a href="qfiledialog.html#ViewMode-enum">ViewMode</a> <a name="viewMode"></a>QFileDialog::viewMode () const
|
---|
| 815 | </h3><p>Returns the file dialog's view mode.
|
---|
| 816 | See the <a href="qfiledialog.html#viewMode-prop">"viewMode"</a> property for details.
|
---|
| 817 | <hr><h2>Property Documentation</h2>
|
---|
| 818 | <h3 class=fn>bool <a name="contentsPreview-prop"></a>contentsPreview</h3>
|
---|
| 819 | <p>This property holds whether the file dialog can provide a contents preview of the currently selected file.
|
---|
| 820 | <p>The default is FALSE.
|
---|
| 821 | <p> <p>See also <a href="#setContentsPreview">setContentsPreview</a>() and <a href="#infoPreview-prop">infoPreview</a>.
|
---|
| 822 |
|
---|
| 823 | <p>Set this property's value with <a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>() and get this property's value with <a href="#isContentsPreviewEnabled">isContentsPreviewEnabled</a>().
|
---|
| 824 | <h3 class=fn><a href="qstring.html">QString</a> <a name="dirPath-prop"></a>dirPath</h3>
|
---|
| 825 | <p>This property holds the file dialog's working directory.
|
---|
| 826 | <p>Get this property's value with <a href="#dirPath">dirPath</a>().
|
---|
| 827 | <p><p>See also <a href="#dir">dir</a>() and <a href="#setDir">setDir</a>().
|
---|
| 828 |
|
---|
| 829 | <h3 class=fn>bool <a name="infoPreview-prop"></a>infoPreview</h3>
|
---|
| 830 | <p>This property holds whether the file dialog can provide preview information about the currently selected file.
|
---|
| 831 | <p>The default is FALSE.
|
---|
| 832 |
|
---|
| 833 | <p>Set this property's value with <a href="#setInfoPreviewEnabled">setInfoPreviewEnabled</a>() and get this property's value with <a href="#isInfoPreviewEnabled">isInfoPreviewEnabled</a>().
|
---|
| 834 | <h3 class=fn><a href="qfiledialog.html#Mode-enum">Mode</a> <a name="mode-prop"></a>mode</h3>
|
---|
| 835 | <p>This property holds the file dialog's mode.
|
---|
| 836 | <p>The default mode is <a href="#Mode-enum">ExistingFile</a>.
|
---|
| 837 |
|
---|
| 838 | <p>Set this property's value with <a href="#setMode">setMode</a>() and get this property's value with <a href="#mode">mode</a>().
|
---|
| 839 | <h3 class=fn><a href="qfiledialog.html#PreviewMode-enum">PreviewMode</a> <a name="previewMode-prop"></a>previewMode</h3>
|
---|
| 840 | <p>This property holds the preview mode for the file dialog.
|
---|
| 841 | <p>If you set the mode to be a mode other than <em>NoPreview</em>, you must
|
---|
| 842 | use <a href="#setInfoPreview">setInfoPreview</a>() or <a href="#setContentsPreview">setContentsPreview</a>() to set the dialog's
|
---|
| 843 | preview widget to your preview widget and enable the preview
|
---|
| 844 | widget(s) with <a href="#setInfoPreviewEnabled">setInfoPreviewEnabled</a>() or
|
---|
| 845 | <a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>().
|
---|
| 846 | <p> <p>See also <a href="#infoPreview-prop">infoPreview</a>, <a href="#contentsPreview-prop">contentsPreview</a>, and <a href="#viewMode-prop">viewMode</a>.
|
---|
| 847 |
|
---|
| 848 | <p>Set this property's value with <a href="#setPreviewMode">setPreviewMode</a>() and get this property's value with <a href="#previewMode">previewMode</a>().
|
---|
| 849 | <h3 class=fn><a href="qstring.html">QString</a> <a name="selectedFile-prop"></a>selectedFile</h3>
|
---|
| 850 | <p>This property holds the name of the selected file.
|
---|
| 851 | <p>If a file was selected selectedFile contains the file's name including
|
---|
| 852 | its absolute path; otherwise selectedFile is empty.
|
---|
| 853 | <p> <p>See also <a href="qstring.html#isEmpty">QString::isEmpty</a>(), <a href="#selectedFiles-prop">selectedFiles</a>, and <a href="#selectedFilter-prop">selectedFilter</a>.
|
---|
| 854 |
|
---|
| 855 | <p>Get this property's value with <a href="#selectedFile">selectedFile</a>().
|
---|
| 856 | <h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="selectedFiles-prop"></a>selectedFiles</h3>
|
---|
| 857 | <p>This property holds the list of selected files.
|
---|
| 858 | <p>If one or more files are selected, selectedFiles contains their
|
---|
| 859 | names including their absolute paths. If no files are selected or
|
---|
| 860 | the mode isn't ExistingFiles selectedFiles is an empty list.
|
---|
| 861 | <p> It is more convenient to use <a href="#selectedFile">selectedFile</a>() if the mode is
|
---|
| 862 | <a href="#Mode-enum">ExistingFile</a>, <a href="#Mode-enum">Directory</a> or <a href="#Mode-enum">DirectoryOnly</a>.
|
---|
| 863 | <p> Note that if you want to iterate over the list, you should
|
---|
| 864 | iterate over a copy, e.g.
|
---|
| 865 | <pre>
|
---|
| 866 | <a href="qstringlist.html">QStringList</a> list = myFileDialog.selectedFiles();
|
---|
| 867 | QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
|
---|
| 868 | while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
|
---|
| 869 | myProcessing( *it );
|
---|
| 870 | ++it;
|
---|
| 871 | }
|
---|
| 872 | </pre>
|
---|
| 873 |
|
---|
| 874 | <p> <p>See also <a href="#selectedFile-prop">selectedFile</a>, <a href="#selectedFilter-prop">selectedFilter</a>, and <a href="qvaluelist.html#empty">QValueList::empty</a>().
|
---|
| 875 |
|
---|
| 876 | <p>Get this property's value with <a href="#selectedFiles">selectedFiles</a>().
|
---|
| 877 | <h3 class=fn><a href="qstring.html">QString</a> <a name="selectedFilter-prop"></a>selectedFilter</h3>
|
---|
| 878 | <p>This property holds the filter which the user has selected in the file dialog.
|
---|
| 879 | <p>Get this property's value with <a href="#selectedFilter">selectedFilter</a>().
|
---|
| 880 | <p><p>See also <a href="#filterSelected">filterSelected</a>(), <a href="#selectedFiles-prop">selectedFiles</a>, and <a href="#selectedFile-prop">selectedFile</a>.
|
---|
| 881 |
|
---|
| 882 | <h3 class=fn>bool <a name="showHiddenFiles-prop"></a>showHiddenFiles</h3>
|
---|
| 883 | <p>This property holds whether hidden files are shown in the file dialog.
|
---|
| 884 | <p>The default is FALSE, i.e. don't show hidden files.
|
---|
| 885 |
|
---|
| 886 | <p>Set this property's value with <a href="#setShowHiddenFiles">setShowHiddenFiles</a>() and get this property's value with <a href="#showHiddenFiles">showHiddenFiles</a>().
|
---|
| 887 | <h3 class=fn><a href="qfiledialog.html#ViewMode-enum">ViewMode</a> <a name="viewMode-prop"></a>viewMode</h3>
|
---|
| 888 | <p>This property holds the file dialog's view mode.
|
---|
| 889 | <p>If you set the view mode to be <em>Detail</em> (the default), then you
|
---|
| 890 | will see the file's details, such as the size of the file and the
|
---|
| 891 | date the file was last modified in addition to the file's name.
|
---|
| 892 | <p> If you set the view mode to be <em>List</em>, then you will just
|
---|
| 893 | see a list of the files and folders.
|
---|
| 894 | <p> See <a href="#ViewMode-enum">QFileDialog::ViewMode</a>
|
---|
| 895 |
|
---|
| 896 | <p>Set this property's value with <a href="#setViewMode">setViewMode</a>() and get this property's value with <a href="#viewMode">viewMode</a>().
|
---|
| 897 | <!-- eof -->
|
---|
| 898 | <hr><p>
|
---|
| 899 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 900 | Copyright © 1995-2007
|
---|
| 901 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 902 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 903 | <td>Copyright © 2007
|
---|
| 904 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 905 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 906 | </table></div></address></body>
|
---|
| 907 | </html>
|
---|