Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1276

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/dialogs/qfiledialog.cpp:1979 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QFileDialog Class</title>
<style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<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>

<p>The QFileDialog class provides dialogs that allow users to select files or directories.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qfiledialog-h.html">qfiledialog.h</a>&gt;</tt>
<p>Inherits <a href="qdialog.html">QDialog</a>.
<p><a href="qfiledialog-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn><a href="#QFileDialog"><b>QFileDialog</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;dirName, const&nbsp;QString&nbsp;&amp;&nbsp;filter = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = FALSE )</div></li>
<li><div class=fn><a href="#QFileDialog-2"><b>QFileDialog</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = FALSE )</div></li>
<li><div class=fn><a href="#~QFileDialog"><b>~QFileDialog</b></a> ()</div></li>
<li><div class=fn>QString <a href="#selectedFile"><b>selectedFile</b></a> () const</div></li>
<li><div class=fn>QString <a href="#selectedFilter"><b>selectedFilter</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setSelectedFilter"><b>setSelectedFilter</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;mask )</div></li>
<li><div class=fn>virtual void <a href="#setSelectedFilter-2"><b>setSelectedFilter</b></a> ( int&nbsp;n )</div></li>
<li><div class=fn>void <a href="#setSelection"><b>setSelection</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;filename )</div></li>
<li><div class=fn>void <a href="#selectAll"><b>selectAll</b></a> ( bool&nbsp;b )</div></li>
<li><div class=fn>QStringList <a href="#selectedFiles"><b>selectedFiles</b></a> () const</div></li>
<li><div class=fn>QString <a href="#dirPath"><b>dirPath</b></a> () const</div></li>
<li><div class=fn>void <a href="#setDir"><b>setDir</b></a> ( const&nbsp;QDir&nbsp;&amp;&nbsp;dir )</div></li>
<li><div class=fn>const QDir * <a href="#dir"><b>dir</b></a> () const</div></li>
<li><div class=fn>void <a href="#setShowHiddenFiles"><b>setShowHiddenFiles</b></a> ( bool&nbsp;s )</div></li>
<li><div class=fn>bool <a href="#showHiddenFiles"><b>showHiddenFiles</b></a> () const</div></li>
<li><div class=fn>void <a href="#rereadDir"><b>rereadDir</b></a> ()</div></li>
<li><div class=fn>void <a href="#resortDir"><b>resortDir</b></a> ()</div></li>
<li><div class=fn>enum <a href="#Mode-enum"><b>Mode</b></a> { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly }</div></li>
<li><div class=fn>void <a href="#setMode"><b>setMode</b></a> ( Mode )</div></li>
<li><div class=fn>Mode <a href="#mode"><b>mode</b></a> () const</div></li>
<li><div class=fn>enum <a href="#ViewMode-enum"><b>ViewMode</b></a> { Detail, List }</div></li>
<li><div class=fn>enum <a href="#PreviewMode-enum"><b>PreviewMode</b></a> { NoPreview, Contents, Info }</div></li>
<li><div class=fn>void <a href="#setViewMode"><b>setViewMode</b></a> ( ViewMode&nbsp;m )</div></li>
<li><div class=fn>ViewMode <a href="#viewMode"><b>viewMode</b></a> () const</div></li>
<li><div class=fn>void <a href="#setPreviewMode"><b>setPreviewMode</b></a> ( PreviewMode&nbsp;m )</div></li>
<li><div class=fn>PreviewMode <a href="#previewMode"><b>previewMode</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isInfoPreviewEnabled"><b>isInfoPreviewEnabled</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isContentsPreviewEnabled"><b>isContentsPreviewEnabled</b></a> () const</div></li>
<li><div class=fn>void <a href="#setInfoPreviewEnabled"><b>setInfoPreviewEnabled</b></a> ( bool )</div></li>
<li><div class=fn>void <a href="#setContentsPreviewEnabled"><b>setContentsPreviewEnabled</b></a> ( bool )</div></li>
<li><div class=fn>void <a href="#setInfoPreview"><b>setInfoPreview</b></a> ( QWidget&nbsp;*&nbsp;w, QFilePreview&nbsp;*&nbsp;preview )</div></li>
<li><div class=fn>void <a href="#setContentsPreview"><b>setContentsPreview</b></a> ( QWidget&nbsp;*&nbsp;w, QFilePreview&nbsp;*&nbsp;preview )</div></li>
<li><div class=fn>QUrl <a href="#url"><b>url</b></a> () const</div></li>
<li><div class=fn>void <a href="#addFilter"><b>addFilter</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;filter )</div></li>
</ul>
<h2>Public Slots</h2>
<ul>
<li><div class=fn>void <a href="#setDir-2"><b>setDir</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;pathstr )</div></li>
<li><div class=fn>void <a href="#setUrl"><b>setUrl</b></a> ( const&nbsp;QUrlOperator&nbsp;&amp;&nbsp;url )</div></li>
<li><div class=fn>void <a href="#setFilter"><b>setFilter</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;newFilter )</div></li>
<li><div class=fn>void <a href="#setFilters"><b>setFilters</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;filters )</div></li>
<li><div class=fn>void <a href="#setFilters-2"><b>setFilters</b></a> ( const&nbsp;char&nbsp;**&nbsp;types )</div></li>
<li><div class=fn>void <a href="#setFilters-3"><b>setFilters</b></a> ( const QStringList &amp; )</div></li>
</ul>
<h2>Signals</h2>
<ul>
<li><div class=fn>void <a href="#fileHighlighted"><b>fileHighlighted</b></a> ( const QString &amp; )</div></li>
<li><div class=fn>void <a href="#fileSelected"><b>fileSelected</b></a> ( const QString &amp; )</div></li>
<li><div class=fn>void <a href="#filesSelected"><b>filesSelected</b></a> ( const QStringList &amp; )</div></li>
<li><div class=fn>void <a href="#dirEntered"><b>dirEntered</b></a> ( const QString &amp; )</div></li>
<li><div class=fn>void <a href="#filterSelected"><b>filterSelected</b></a> ( const QString &amp; )</div></li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li><div class=fn>QString <a href="#getOpenFileName"><b>getOpenFileName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;startWith = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;filter = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;QString&nbsp;&amp;&nbsp;caption = QString::null, QString&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )</div></li>
<li><div class=fn>QString <a href="#getSaveFileName"><b>getSaveFileName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;startWith = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;filter = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;QString&nbsp;&amp;&nbsp;caption = QString::null, QString&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )</div></li>
<li><div class=fn>QString <a href="#getExistingDirectory"><b>getExistingDirectory</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;dir = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;QString&nbsp;&amp;&nbsp;caption = QString::null, bool&nbsp;dirOnly = TRUE, bool&nbsp;resolveSymlinks = TRUE )</div></li>
<li><div class=fn>QStringList <a href="#getOpenFileNames"><b>getOpenFileNames</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;filter = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;dir = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;QString&nbsp;&amp;&nbsp;caption = QString::null, QString&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )</div></li>
<li><div class=fn>void <a href="#setIconProvider"><b>setIconProvider</b></a> ( QFileIconProvider&nbsp;*&nbsp;provider )</div></li>
<li><div class=fn>QFileIconProvider * <a href="#iconProvider"><b>iconProvider</b></a> ()</div></li>
</ul>
<h2>Properties</h2>
<ul>
<li><div class=fn>bool <a href="#contentsPreview-prop"><b>contentsPreview</b></a>&nbsp;- whether the file dialog offers the possibility of previewing the contents of the currently selected file</div></li>
<li><div class=fn>QString <a href="#dirPath-prop"><b>dirPath</b></a>&nbsp;- the file dialog's working directory &nbsp;<em>(read only)</em></div></li>
<li><div class=fn>bool <a href="#infoPreview-prop"><b>infoPreview</b></a>&nbsp;- whether the file dialog offers the possibility to preview information about the currently selected file</div></li>
<li><div class=fn>Mode <a href="#mode-prop"><b>mode</b></a>&nbsp;- the file dialog's mode</div></li>
<li><div class=fn>PreviewMode <a href="#previewMode-prop"><b>previewMode</b></a>&nbsp;- the preview mode for the file dialog</div></li>
<li><div class=fn>QString <a href="#selectedFile-prop"><b>selectedFile</b></a>&nbsp;- the name of the selected file &nbsp;<em>(read only)</em></div></li>
<li><div class=fn>QStringList <a href="#selectedFiles-prop"><b>selectedFiles</b></a>&nbsp;- a list of selected files &nbsp;<em>(read only)</em></div></li>
<li><div class=fn>QString <a href="#selectedFilter-prop"><b>selectedFilter</b></a>&nbsp;- the filter which the user has selected in the file dialog &nbsp;<em>(read only)</em></div></li>
<li><div class=fn>bool <a href="#showHiddenFiles-prop"><b>showHiddenFiles</b></a>&nbsp;- whether hidden files are shown in the file dialog</div></li>
<li><div class=fn>ViewMode <a href="#viewMode-prop"><b>viewMode</b></a>&nbsp;- the file dialog's view mode</div></li>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class=fn>void <a href="#addWidgets"><b>addWidgets</b></a> ( QLabel&nbsp;*&nbsp;l, QWidget&nbsp;*&nbsp;w, QPushButton&nbsp;*&nbsp;b )</div></li>
<li><div class=fn>void <a href="#addToolButton"><b>addToolButton</b></a> ( QButton&nbsp;*&nbsp;b, bool&nbsp;separator = FALSE )</div></li>
<li><div class=fn>void <a href="#addLeftWidget"><b>addLeftWidget</b></a> ( QWidget&nbsp;*&nbsp;w )</div></li>
<li><div class=fn>void <a href="#addRightWidget"><b>addRightWidget</b></a> ( QWidget&nbsp;*&nbsp;w )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QFileDialog class provides dialogs that allow users to select files or directories.


<p> The QFileDialog class enables a user to traverse their file system in
order to select one or many files or a directory.
<p> The easiest way to create a QFileDialog is to use the static
functions.  On Windows, these static functions will call the native
Windows file dialog and on Mac OS X, these static function will call
the native Mac OS X file dialog.
<p> <pre>
    <a href="qstring.html">QString</a> s = QFileDialog::<a href="#getOpenFileName">getOpenFileName</a>( "/home",
                                              "Images (*.png *.xpm *.jpg)",
                                              this,
                                              "open file dialog"
                                              "Choose a file" );
  </pre>
 
<p> In the above example, a modal QFileDialog is created using a static
function.  The startup directory is set to "/home".  The file filter
is set to "Images (*.png *.xpm *.jpg)".  The parent of the file dialog
is set to <em>this</em> and it is given the identification name - "open file
dialog".  The caption at the top of file dialog is set to "Choose a
file".
<p> You can create your own QFileDialog without using the static
functions.  By calling <a href="#setMode">setMode</a>(), you can set what can be returned by
the QFileDialog.
<p> <pre>
    QFileDialog* fd = new QFileDialog( this, "file dialog", TRUE );
    fd-&gt;<a href="#setMode">setMode</a>( QFileDialog::<a href="#Mode-enum">AnyFile</a> );
  </pre>
 
<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
file that doesn't exist.  This mode is useful for creating a "File Save
As" file dialog. Use <a href="#Mode-enum">ExistingFile</a> if the user must select an
existing file or <a href="#Mode-enum">Directory</a> if only a directory must be selected.
(See the <a href="#Mode-enum">QFileDialog::Mode</a> enum for the complete list of modes.)
<p> You can retrieve the dialog's mode with <a href="#mode">mode</a>(). Use <a href="#setFilter">setFilter</a>() to set
the dialog's file filter, e.g.
<p> <pre>
    fd-&gt;setFilter( "Images (*.png *.xpm *.jpg)" );
  </pre>
 
<p> In the above example, the filter is set to "Images (*.png *.xpm
*.jpg)", this means that only files with the extension <tt>png</tt>, <tt>xpm</tt>
or <tt>jpg</tt> files will be visible in the QFileDialog.  You can apply
several filters by using <a href="#setFilters">setFilters</a>() and add additional filters with
<a href="#addFilter">addFilter</a>(). Use <a href="#setSelectedFilter">setSelectedFilter</a>() to select one of the filters
you've given as the file dialog's default filter. Whenever the user
changes the filter the <a href="#filterSelected">filterSelected</a>() signal is emitted.
<p> The file dialog has two  view modes, QFileDialog::List which simply
lists file and directory names and QFileDialog::Detail which
displays additional information beside each name, e.g. file size,
modification date, etc. Set the move with <a href="#setViewMode">setViewMode</a>().
<p> <pre>
    fd-&gt;setViewMode( QFileDialog::<a href="#ViewMode-enum">Detail</a> );
  </pre>
 
<p> The last important function you will need to use when creating your
own file dialog is <a href="#selectedFile">selectedFile</a>().
<p> <pre>
    <a href="qstring.html">QString</a> fileName;
    if ( fd-&gt;exec() == QDialog::<a href="qdialog.html#DialogCode-enum">Accepted</a> )
        fileName = fd-&gt;selectedFile();
  </pre>
 
<p> In the above example, a modal file dialog is created and shown.  If
the user clicked OK, then the file they selected is put in <tt>fileName</tt>.
<p> If you are using the <a href="#Mode-enum">ExistingFiles</a> mode then you will need to use
<a href="#selectedFiles">selectedFiles</a>() which will return the selected files in a <a href="qstringlist.html">QStringList</a>.
<p> The dialog's working directory can be set with <a href="#setDir">setDir</a>(). The display
of hidden files is controlled with <a href="#setShowHiddenFiles">setShowHiddenFiles</a>(). The dialog
can be forced to re-read the directory with <a href="#rereadDir">rereadDir</a>() and re-sort
the directory with <a href="#resortDir">resortDir</a>(). All the files in the current directory
can be selected with <a href="#selectAll">selectAll</a>().
<p> <h3>Creating and using preview widgets</h3>
<p> There are two kinds of preview widgets that can be used with
QFileDialogs: <em>content</em> preview widgets and <em>information</em> preview
widgets. They are created and used in the same way except that the
function names differ, e.g. <a href="#setContentsPreview">setContentsPreview</a>() and <a href="#setInfoPreview">setInfoPreview</a>().
<p> A preview widget is a widget that is placed inside a QFileDialog so
that the user can see either the contents of the file, or information
about the file.
<p> <pre>
    class Preview : public <a href="qlabel.html">QLabel</a>, public QFilePreview
    {
    public:
        Preview( <a href="qwidget.html">QWidget</a> *parent=0 ) : <a href="qlabel.html">QLabel</a>( parent ) {}

        void previewUrl( const <a href="qurl.html">QUrl</a> &amp;u )
        {
            <a href="qstring.html">QString</a> path = u.<a href="qurl.html#path">path</a>();
            <a href="qpixmap.html">QPixmap</a> pix( path );
            if ( pix.<a href="qpixmap.html#isNull">isNull</a>() )
                setText( "This is not a pixmap" );
            else
                setPixmap( pix );
        }
    };
  </pre>
 
<p> In the above snippet, we create a preview widget which inherits from
<a href="qlabel.html">QLabel</a> and <a href="qfilepreview.html">QFilePreview</a>. File preview widgets <em>must</em> inherit from
QFilePreview.
<p> Inside the class we reimplement <a href="qfilepreview.html#previewUrl">QFilePreview::previewUrl</a>(), this is
where we determine what happens when a file is selected.  In the case
above we only show a preview of the file if it is a valid pixmap.
Now we tell a file dialog that we have a preview widget that we want
it to use.
<p> <pre>
    Preview* p = new Preview;

    QFileDialog* fd = new QFileDialog( this );
    fd-&gt;<a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE );
    fd-&gt;<a href="#setContentsPreview">setContentsPreview</a>( p, p );
    fd-&gt;<a href="#setPreviewMode">setPreviewMode</a>( QFileDialog::<a href="#PreviewMode-enum">Contents</a> );
    fd-&gt;<a href="qdialog.html#show">show</a>();
  </pre>
 
<p> The first line creates an instance of our preview widget.  We then
create our file dialog and call <a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE ),
this tell the file dialog to preview the contents of the currently
selected file.  We then call <a href="#setContentsPreview">setContentsPreview</a>() -- note that we pass
the same preview widget twice. Finally, before showing the file
dialog, we call <a href="#setPreviewMode">setPreviewMode</a>() setting the mode to <em>Contents</em> which
will show the contents the file that the user has selected.
<p> If you create another preview widget that is used for displaying
information about a file, create it in the same way as we have the
contents preview widget and call <a href="#setInfoPreviewEnabled">setInfoPreviewEnabled</a>(), and
<a href="#setInfoPreview">setInfoPreview</a>().  Then the user will be able to switch between the
two preview modes.
<p> For more information about creating a <a href="qfilepreview.html">QFilePreview</a> widget see QFilePreview.
<p> <img src=qfiledlg-m.png> <img src=qfiledlg-w.png>
<p> <p>See also <a href="dialogs.html">Dialog Classes</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Mode-enum"></a>QFileDialog::Mode</h3> 
<p> This enum is used to indicate what the user may select in the file
dialog, i.e. what the dialog will return if the user clicks OK.
<ul>
<li><tt>QFileDialog::AnyFile</tt> - The name of a file, whether it exists or not.
<li><tt>QFileDialog::ExistingFile</tt> - The name of a single existing file.
<li><tt>QFileDialog::Directory</tt> - The name of a directory. Both files and directories
are displayed.
<li><tt>QFileDialog::DirectoryOnly</tt> - The name of a directory. The file dialog will only display directories.
<li><tt>QFileDialog::ExistingFiles</tt> - The names of zero or more existing files.
</ul><p> See <a href="#setMode">setMode</a>().

<h3 class=fn><a name="PreviewMode-enum"></a>QFileDialog::PreviewMode</h3>

<p> This enum describes the preview mode of the file dialog.
<ul>
<li><tt>QFileDialog::NoPreview</tt> - No preview is shown at all.
<li><tt>QFileDialog::Contents</tt> - Show a preview of the contents of the current file
using the contents preview widget.
<li><tt>QFileDialog::Info</tt> - Show information about the current file using the
info preview widget.
</ul><p> See <a href="#setPreviewMode">setPreviewMode</a>(), <a href="#setContentsPreview">setContentsPreview</a>() and <a href="#setInfoPreview">setInfoPreview</a>().

<h3 class=fn><a name="ViewMode-enum"></a>QFileDialog::ViewMode</h3>

<p> This enum describes the view mode of the file dialog, i.e. what
information about each file it will display.
<ul>
<li><tt>QFileDialog::List</tt> - Display file and directory names with icons.
<li><tt>QFileDialog::Detail</tt> - Display file and directory names with icons plus additional information, e.g. file size, modification date.
</ul><p> See <a href="#setViewMode">setViewMode</a>().

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QFileDialog"></a>QFileDialog::QFileDialog ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;dirName, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filter = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = FALSE )
</h3>
Constructs a file dialog with the parent <em>parent</em>, the name <em>name</em>
If <em>modal</em> is TRUE then the file dialog is modal; otherwise it is
non-modal.
<p> If <em>dirName</em> is specified then it will be used as the dialog's
working directory, i.e. it will be the directory that is shown when
the dialog appears. If <em>filter</em> is specified it will be used as the
dialog's file filter.
<p> 
<h3 class=fn><a name="QFileDialog-2"></a>QFileDialog::QFileDialog ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = FALSE )
</h3>
Constructs a file dialog with the parent, <em>parent</em>, and the name,
<em>name</em>. If <em>modal</em> is TRUE then the file dialog is modal;
otherwise it is non-modal.

<h3 class=fn><a name="~QFileDialog"></a>QFileDialog::~QFileDialog ()
</h3>
Destroys the file dialog.

<h3 class=fn>void <a name="addFilter"></a>QFileDialog::addFilter ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filter )
</h3>
Adds the filter <em>filter</em> to the list of filters and makes it the current one.
<p> <pre>
    QFileDialog* fd = new QFileDialog( this );
    fd-&gt;<a href="#addFilter">addFilter</a>( "Images (*.png *.jpg *.xpm)" );
    fd-&gt;<a href="qdialog.html#show">show</a>();
  </pre>
 
<p> In the above example, a file dialog is created, and the file filter - "Images
(*.png *.jpg *.xpm)" is added and is set as the current filter.  The original
filter - "All Files (*)" is still available.
<p> <p>See also <a href="#setFilter">setFilter</a>() and <a href="#setFilters">setFilters</a>().

<h3 class=fn>void <a name="addLeftWidget"></a>QFileDialog::addLeftWidget ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;w )<tt> [protected]</tt>
</h3>
Adds the widget <em>w</em> to the left-hand side of the file dialog.
<p> <p>See also <a href="#addRightWidget">addRightWidget</a>(), <a href="#addWidgets">addWidgets</a>() and <a href="#addToolButton">addToolButton</a>().

<h3 class=fn>void <a name="addRightWidget"></a>QFileDialog::addRightWidget ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;w )<tt> [protected]</tt>
</h3>
Adds the widget <em>w</em> to the right-hand side of the file dialog.
<p> <p>See also <a href="#addLeftWidget">addLeftWidget</a>(), <a href="#addWidgets">addWidgets</a>() and <a href="#addToolButton">addToolButton</a>().

<h3 class=fn>void <a name="addToolButton"></a>QFileDialog::addToolButton ( <a href="qbutton.html">QButton</a>&nbsp;*&nbsp;b, bool&nbsp;separator = FALSE )<tt> [protected]</tt>
</h3>
Adds the tool button <em>b</em> to the row of tool buttons at the top of the
file dialog. The button is appended to the right of
this row. If <em>separator</em> is TRUE, a small space is inserted between the
last button of the row and the new button <em>b</em>.
<p> <p>See also <a href="#addWidgets">addWidgets</a>(), <a href="#addLeftWidget">addLeftWidget</a>() and <a href="#addRightWidget">addRightWidget</a>().

<h3 class=fn>void <a name="addWidgets"></a>QFileDialog::addWidgets ( <a href="qlabel.html">QLabel</a>&nbsp;*&nbsp;l, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;w, <a href="qpushbutton.html">QPushButton</a>&nbsp;*&nbsp;b )<tt> [protected]</tt>
</h3>
<pre>
    MyFileDialog::MyFileDialog( <a href="qwidget.html">QWidget</a>* parent, const char* name ) :
        <a href="#QFileDialog">QFileDialog</a>( parent, name )
    {
        <a href="qlabel.html">QLabel</a>* label = new <a href="qlabel.html">QLabel</a>( "Added widgets", this );
        <a href="qlineedit.html">QLineEdit</a>* lineedit = new <a href="qlineedit.html">QLineEdit</a>( this );
        <a href="qtoolbutton.html">QToolButton</a>* toolbutton = new <a href="qtoolbutton.html">QToolButton</a>( this );

        <a href="#addWidgets">addWidgets</a>( label, lineedit, toolbutton );
    }
  </pre>
 
<p> Adds the specified widgets to the bottom of the file dialog.  The
label <em>l</em> is placed underneath the "file name" and the "file types"
labels.  The widget <em>w</em> is placed underneath the file types combobox.
The button <em>b</em> is placed underneath the cancel pushbutton.
<p> If you don't want to have one of the widgets to be added then just pass 0
instead of a label, widget or pushbutton.
<p> Every time you call this function, a new row of widgets will be added
to the bottom of the file dialog.
<p> <p>See also <a href="#addToolButton">addToolButton</a>(), <a href="#addLeftWidget">addLeftWidget</a>() and <a href="#addRightWidget">addRightWidget</a>().

<h3 class=fn>const&nbsp;<a href="qdir.html">QDir</a>&nbsp;* <a name="dir"></a>QFileDialog::dir () const
</h3>
Returns the current directory shown in the file dialog.
<p>See also <a href="#setDir">setDir</a>().

<h3 class=fn>void <a name="dirEntered"></a>QFileDialog::dirEntered ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when the user enters a directory.
<p> <p>See also <a href="#dir">dir</a>().

<h3 class=fn><a href="qstring.html">QString</a> <a name="dirPath"></a>QFileDialog::dirPath () const
</h3><p>Returns the file dialog's working directory.
See the <a href="qfiledialog.html#dirPath-prop">"dirPath"</a> property for details.
<h3 class=fn>void <a name="fileHighlighted"></a>QFileDialog::fileHighlighted ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when the user highlights a file.
<p> <p>See also <a href="#fileSelected">fileSelected</a>() and <a href="#filesSelected">filesSelected</a>().

<h3 class=fn>void <a name="fileSelected"></a>QFileDialog::fileSelected ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when the user selects a file.
<p> <p>See also <a href="#filesSelected">filesSelected</a>(), <a href="#fileHighlighted">fileHighlighted</a>() and <a href="#selectedFile-prop">selectedFile</a>.

<h3 class=fn>void <a name="filesSelected"></a>QFileDialog::filesSelected ( const&nbsp;<a href="qstringlist.html">QStringList</a>&nbsp;&amp; )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when the user selects one or more files in <em>ExistingFiles</em> mode.
<p> <p>See also <a href="#fileSelected">fileSelected</a>(), <a href="#fileHighlighted">fileHighlighted</a>() and <a href="#selectedFiles-prop">selectedFiles</a>.

<h3 class=fn>void <a name="filterSelected"></a>QFileDialog::filterSelected ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [signal]</tt>
</h3>

<p> This signal is emitted when the user selects a filter.
<p> <p>See also <a href="#selectedFilter-prop">selectedFilter</a>.

<h3 class=fn><a href="qstring.html">QString</a> <a name="getExistingDirectory"></a>QFileDialog::getExistingDirectory ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;dir = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption = QString::null, bool&nbsp;dirOnly = TRUE, bool&nbsp;resolveSymlinks = TRUE )<tt> [static]</tt>
</h3>
This is a convenience static function that will return an existing directory
selected by the user.
<p> <pre>
    <a href="qstring.html">QString</a> s = QFileDialog::<a href="#getExistingDirectory">getExistingDirectory</a>(
                    "/home",
                    this, "get existing directory"
                    "Choose a directory", TRUE );
  </pre>
 
<p> This function creates a modal file dialog with parent <em>parent</em>,
and name <em>name</em>. If a parent is specified the dialog
will be shown centered over the parent.
<p> The dialog's working directory is set to <em>dir</em>, and the caption is
set to <em>caption</em>. Either of these may be <a href="qstring.html#QString-null">QString::null</a> in which case
the current directory and a default caption will be used respectively.
<p> If <em>dirOnly</em> is TRUE, then only directories will be shown in
the file dialog; otherwise both directories and files will be shown.
<p> Under Unix/X11, the normal behavior of the file dialog is to resolve
and follow symlinks.  For example, if /usr/tmp is a symlink to /var/tmp,
the file dialog will change to /var/tmp after entering /usr/tmp.
If <em>resolveSymlinks</em> is FALSE, the file dialog will treat
symlinks as regular directories.
<p> <p>See also <a href="#getOpenFileName">getOpenFileName</a>(), <a href="#getOpenFileNames">getOpenFileNames</a>() and <a href="#getSaveFileName">getSaveFileName</a>().

<h3 class=fn><a href="qstring.html">QString</a> <a name="getOpenFileName"></a>QFileDialog::getOpenFileName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;startWith = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filter = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption = QString::null, <a href="qstring.html">QString</a>&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )<tt> [static]</tt>
</h3>
This is a convenience static function that returns an existing file
selected by the user. If the user pressed cancel, it returns a null
string.
<p> <pre>
    <a href="qstring.html">QString</a> s = QFileDialog::<a href="#getOpenFileName">getOpenFileName</a>(
                    "/home", "Images (*.png *.xpm *.jpg)",
                    this, "open file dialog",
                    "Choose a file" );
  </pre>
 
<p> The function creates a modal file dialog with parent <em>parent</em>, and
name <em>name</em>.  If a parent is specified, then the dialog will be shown
centered over the parent.
<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
is set to <em>filter</em> so that only those files which match the filter
are shown.  The filter selected is set to <em>selectedFilter</em>. The parameters
<em>startWith</em>, <em>selectedFilter</em> and <em>filter</em> may be <a href="qstring.html#QString-null">QString::null</a>.
<p> The dialog's caption is set to <em>caption</em>. If <em>caption</em> is not
specified then a default caption will be used.
<p> Under Windows and Mac OS X, this static function will use the native
file dialog and not a QFileDialog, unless the style of the application
is set to something other than the native style.
<p> Under Unix/X11, the normal behavior of the file dialog is to resolve
and follow symlinks.  For example, if /usr/tmp is a symlink to /var/tmp,
the file dialog will change to /var/tmp after entering /usr/tmp.
If <em>resolveSymlinks</em> is FALSE, the file dialog will treat
symlinks as regular directories.
<p> <p>See also <a href="#getOpenFileNames">getOpenFileNames</a>(), <a href="#getSaveFileName">getSaveFileName</a>() and <a href="#getExistingDirectory">getExistingDirectory</a>().

<p>Examples: <a href="qaction-application-example.html#x2020">action/application.cpp</a>, <a href="addressbook-example.html#x1958">addressbook/mainwindow.cpp</a>, <a href="simple-application-example.html#x1917">application/application.cpp</a>, <a href="helpviewer-example.html#x1396">helpviewer/helpwindow.cpp</a>, <a href="mdi-example.html#x1143">mdi/application.cpp</a>, <a href="qwerty-example.html#x627">qwerty/qwerty.cpp</a> and <a href="showimg-example.html#x418">showimg/showimg.cpp</a>.
<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="getOpenFileNames"></a>QFileDialog::getOpenFileNames ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filter = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;dir = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption = QString::null, <a href="qstring.html">QString</a>&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )<tt> [static]</tt>
</h3>
This is a convenience static function that will return one or more
existing files as selected by the user.
<p> <pre>
    <a href="qstringlist.html">QStringList</a> files = QFileDialog::<a href="#getOpenFileNames">getOpenFileNames</a>(
                            "Images (*.png *.xpm *.jpg)", "/home",
                            this, "open files dialog"
                            "Select one or more files" );
  </pre>
 
<p> The function creates a modal file dialog with parent <em>parent</em>, and
name <em>name</em>.  If a parent is specified, then the dialog will be shown
centered over the parent.
<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
is set to <em>filter</em> so that only those files which match the filter
are shown.  The filter selected is set to <em>selectedFilter</em>. The parameters
<em>dir</em>, <em>selectedFilter</em> and <em>filter</em> may be <a href="qstring.html#QString-null">QString::null</a>.
<p> The dialog's caption is set to <em>caption</em>. If <em>caption</em> is not
specified then a default caption will be used.
<p> Under Windows and Mac OS X, this static function will use the native
file dialog and not a QFileDialog, unless the style of the application
is set to something other than the native style.
<p> Under Unix/X11, the normal behavior of the file dialog is to resolve
and follow symlinks.  For example, if /usr/tmp is a symlink to /var/tmp,
the file dialog will change to /var/tmp after entering /usr/tmp.
If <em>resolveSymlinks</em> is FALSE, the file dialog will treat
symlinks as regular directories.
<p> Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
<pre>
    <a href="qstringlist.html">QStringList</a> list = files;
    QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
    while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
        myProcessing( *it );
        ++it;
    }
    </pre>
 
<p> <p>See also <a href="#getOpenFileName">getOpenFileName</a>(), <a href="#getSaveFileName">getSaveFileName</a>() and <a href="#getExistingDirectory">getExistingDirectory</a>().

<h3 class=fn><a href="qstring.html">QString</a> <a name="getSaveFileName"></a>QFileDialog::getSaveFileName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;startWith = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filter = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption = QString::null, <a href="qstring.html">QString</a>&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )<tt> [static]</tt>
</h3>
This is a convenience static function that will return a file name
selected by the user. The file does not have to exist.
<p> It creates a modal file dialog with parent <em>parent</em>, and name
<em>name</em>.  If a parent is specified, then the dialog will be shown
centered over the parent.
<p> <pre>
    <a href="qstring.html">QString</a> s = QFileDialog::<a href="#getSaveFileName">getSaveFileName</a>(
                    "/home", "Images (*.png *.xpm *.jpg)",
                    this, "save file dialog"
                    "Choose a file" );
  </pre>
 
<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
is set to <em>filter</em> so that only those files which match the filter
are shown.  The filter selected is set to <em>selectedFilter</em>. The parameters
<em>startWith</em>, <em>selectedFilter</em> and <em>filter</em> may be <a href="qstring.html#QString-null">QString::null</a>.
<p> The dialog's caption is set to <em>caption</em>. If <em>caption</em> is not
specified then a default caption will be used.
<p> Under Windows and Mac OS X, this static function will use the native
file dialog and not a QFileDialog, unless the style of the application
is set to something other than the native style.
<p> Under Unix/X11, the normal behavior of the file dialog is to resolve
and follow symlinks.  For example, if /usr/tmp is a symlink to /var/tmp,
the file dialog will change to /var/tmp after entering /usr/tmp.
If <em>resolveSymlinks</em> is FALSE, the file dialog will treat
symlinks as regular directories.
<p> <p>See also <a href="#getOpenFileName">getOpenFileName</a>(), <a href="#getOpenFileNames">getOpenFileNames</a>() and <a href="#getExistingDirectory">getExistingDirectory</a>().

<p>Examples: <a href="qaction-application-example.html#x2021">action/application.cpp</a>, <a href="addressbook-example.html#x1959">addressbook/mainwindow.cpp</a>, <a href="simple-application-example.html#x1918">application/application.cpp</a>, <a href="mdi-example.html#x1144">mdi/application.cpp</a>, <a href="qmag-example.html#x695">qmag/qmag.cpp</a>, <a href="qwerty-example.html#x628">qwerty/qwerty.cpp</a> and <a href="showimg-example.html#x419">showimg/showimg.cpp</a>.
<h3 class=fn><a href="qfileiconprovider.html">QFileIconProvider</a>&nbsp;* <a name="iconProvider"></a>QFileDialog::iconProvider ()<tt> [static]</tt>
</h3>
<p> Returns a pointer to the icon provider currently set on the file dialog.
By default there is no icon provider, and this function returns 0.
<p> <p>See also <a href="#setIconProvider">setIconProvider</a>() and <a href="qfileiconprovider.html">QFileIconProvider</a>.

<h3 class=fn>bool <a name="isContentsPreviewEnabled"></a>QFileDialog::isContentsPreviewEnabled () const
</h3><p>Returns TRUE if the file dialog offers the possibility of previewing the contents of the currently selected file; otherwise returns FALSE.
See the <a href="qfiledialog.html#contentsPreview-prop">"contentsPreview"</a> property for details.
<h3 class=fn>bool <a name="isInfoPreviewEnabled"></a>QFileDialog::isInfoPreviewEnabled () const
</h3><p>Returns TRUE if the file dialog offers the possibility to preview information about the currently selected file; otherwise returns FALSE.
See the <a href="qfiledialog.html#infoPreview-prop">"infoPreview"</a> property for details.
<h3 class=fn><a href="qfiledialog.html#Mode-enum">Mode</a> <a name="mode"></a>QFileDialog::mode () const
</h3><p>Returns the file dialog's mode.
See the <a href="qfiledialog.html#mode-prop">"mode"</a> property for details.
<h3 class=fn><a href="qfiledialog.html#PreviewMode-enum">PreviewMode</a> <a name="previewMode"></a>QFileDialog::previewMode () const
</h3><p>Returns the preview mode for the file dialog.
See the <a href="qfiledialog.html#previewMode-prop">"previewMode"</a> property for details.
<h3 class=fn>void <a name="rereadDir"></a>QFileDialog::rereadDir ()
</h3>
Rereads the current directory shown in the file dialog.
<p> The only time you will need to call this function is if the contents of
the directory change and you wish to refresh the file dialog to reflect
the change.
<p> <p>See also <a href="#resortDir">resortDir</a>().

<h3 class=fn>void <a name="resortDir"></a>QFileDialog::resortDir ()
</h3>
Re-sorts the displayed directory.
<p> <p>See also <a href="#rereadDir">rereadDir</a>().

<h3 class=fn>void <a name="selectAll"></a>QFileDialog::selectAll ( bool&nbsp;b )
</h3>
If <em>b</em> is TRUE then all the files in the current directory are selected;
otherwise, they are deselected.

<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedFile"></a>QFileDialog::selectedFile () const
</h3><p>Returns the name of the selected file.
See the <a href="qfiledialog.html#selectedFile-prop">"selectedFile"</a> property for details.
<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="selectedFiles"></a>QFileDialog::selectedFiles () const
</h3><p>Returns a list of selected files.
See the <a href="qfiledialog.html#selectedFiles-prop">"selectedFiles"</a> property for details.
<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedFilter"></a>QFileDialog::selectedFilter () const
</h3><p>Returns the filter which the user has selected in the file dialog.
See the <a href="qfiledialog.html#selectedFilter-prop">"selectedFilter"</a> property for details.
<h3 class=fn>void <a name="setContentsPreview"></a>QFileDialog::setContentsPreview ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;w, <a href="qfilepreview.html">QFilePreview</a>&nbsp;*&nbsp;preview )
</h3>
Sets the widget to be used for displaying the contents of the file
to the widget <em>w</em> and a preview of those contents to the
<a href="qfilepreview.html">QFilePreview</a> <em>preview</em>.
<p> Normally you would create a preview widget that derives from both <a href="qwidget.html">QWidget</a> and
QFilePreview, so you should pass the same widget twice.
<p> <pre>
    class Preview : public <a href="qlabel.html">QLabel</a>, public QFilePreview
    {
    public:
        Preview( <a href="qwidget.html">QWidget</a> *parent=0 ) : <a href="qlabel.html">QLabel</a>( parent ) {}

        void previewUrl( const <a href="qurl.html">QUrl</a> &amp;u )
        {
            <a href="qstring.html">QString</a> path = u.<a href="qurl.html#path">path</a>();
            <a href="qpixmap.html">QPixmap</a> pix( path );
            if ( pix.<a href="qpixmap.html#isNull">isNull</a>() )
                setText( "This is not a pixmap" );
            else
                setPixmap( pix );
        }
    };

  //...

  int main( int argc, char** argv )
  {
    Preview* p = new Preview;

    QFileDialog* fd = new QFileDialog( this );
    fd-&gt;<a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE );
    fd-&gt;<a href="#setContentsPreview">setContentsPreview</a>( p, p );
    fd-&gt;<a href="#setPreviewMode">setPreviewMode</a>( QFileDialog::<a href="#PreviewMode-enum">Contents</a> );
    fd-&gt;<a href="qdialog.html#show">show</a>();
  }
  </pre>
 
<p> <p>See also <a href="#contentsPreview-prop">contentsPreview</a>, <a href="#setInfoPreview">setInfoPreview</a>() and <a href="#previewMode-prop">previewMode</a>.

<p>Example: <a href="qdir-example.html#x775">qdir/qdir.cpp</a>.
<h3 class=fn>void <a name="setContentsPreviewEnabled"></a>QFileDialog::setContentsPreviewEnabled ( bool )
</h3><p>Sets whether the file dialog offers the possibility of previewing the contents of the currently selected file.
See the <a href="qfiledialog.html#contentsPreview-prop">"contentsPreview"</a> property for details.
<h3 class=fn>void <a name="setDir"></a>QFileDialog::setDir ( const&nbsp;<a href="qdir.html">QDir</a>&nbsp;&amp;&nbsp;dir )
</h3>
Sets the file dialog's working directory to <em>dir</em>.
<p>See also <a href="#dir">dir</a>().

<h3 class=fn>void <a name="setDir-2"></a>QFileDialog::setDir ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;pathstr )<tt> [slot]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the file dialog's working directory to <em>pathstr</em>.
<p> <p>See also <a href="#dir">dir</a>().

<h3 class=fn>void <a name="setFilter"></a>QFileDialog::setFilter ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;newFilter )<tt> [slot]</tt>
</h3>
<p> Sets the filter used in the file dialog to <em>newFilter</em>.
<p> If <em>newFilter</em> contains a pair of parentheses containing one or more
of <em><b>anything*something</b></em> 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:
<p> <pre>
     fd-&gt;setFilter( "All C++ files (*.cpp *.cc *.C *.cxx *.c++)" );
     fd-&gt;setFilter( "*.cpp *.cc *.C *.cxx *.c++" );
     fd-&gt;setFilter( "All C++ files (*.cpp;*.cc;*.C;*.cxx;*.c++)" );
     fd-&gt;setFilter( "*.cpp;*.cc;*.C;*.cxx;*.c++" );
  </pre>
 
<p> <p>See also <a href="#setFilters">setFilters</a>().

<h3 class=fn>void <a name="setFilters"></a>QFileDialog::setFilters ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filters )<tt> [slot]</tt>
</h3>
Sets the filters used in the file dialog to <em>filters</em>.  Each group
of filters must be separated by <tt>;;</tt>.
<p> <pre>
    <a href="qstring.html">QString</a> types("*.png;;*.xpm;;*.jpg");
    QFileDialog fd = new QFileDialog( this );
    fd-&gt;<a href="#setFilters">setFilters</a>( types );
    fd-&gt;<a href="qdialog.html#show">show</a>();
  </pre>
 
<p> 
<h3 class=fn>void <a name="setFilters-2"></a>QFileDialog::setFilters ( const&nbsp;char&nbsp;**&nbsp;types )<tt> [slot]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>types</em> must be a null-terminated list of strings.
<p> 
<h3 class=fn>void <a name="setFilters-3"></a>QFileDialog::setFilters ( const&nbsp;<a href="qstringlist.html">QStringList</a>&nbsp;&amp; )<tt> [slot]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> 
<h3 class=fn>void <a name="setIconProvider"></a>QFileDialog::setIconProvider ( <a href="qfileiconprovider.html">QFileIconProvider</a>&nbsp;*&nbsp;provider )<tt> [static]</tt>
</h3>
Sets the <a href="qfileiconprovider.html">QFileIconProvider</a> used on the file dialog to the
QFileIconProvider specified by <em>provider</em>.
<p> The default is that there is no QFileIconProvider and QFileDialog
just draws a folder icon next to each directory and nothing next
to the files.
<p> <p>See also <a href="qfileiconprovider.html">QFileIconProvider</a> and <a href="#iconProvider">iconProvider</a>().

<p>Example: <a href="showimg-example.html#x463">showimg/main.cpp</a>.
<h3 class=fn>void <a name="setInfoPreview"></a>QFileDialog::setInfoPreview ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;w, <a href="qfilepreview.html">QFilePreview</a>&nbsp;*&nbsp;preview )
</h3>
Sets the widget to be used for displaying information about the file
to the widget <em>w</em> and a preview of that information to the
<a href="qfilepreview.html">QFilePreview</a> <em>preview</em>.
<p> Normally you would create a preview widget that derives from both <a href="qwidget.html">QWidget</a> and
QFilePreview, so you should pass the same widget twice.
<p> <pre>
    class Preview : public <a href="qlabel.html">QLabel</a>, public QFilePreview
    {
    public:
        Preview( <a href="qwidget.html">QWidget</a> *parent=0 ) : <a href="qlabel.html">QLabel</a>( parent ) {}

        void previewUrl( const <a href="qurl.html">QUrl</a> &amp;u )
        {
            <a href="qstring.html">QString</a> path = u.<a href="qurl.html#path">path</a>();
            <a href="qpixmap.html">QPixmap</a> pix( path );
            if ( pix.<a href="qpixmap.html#isNull">isNull</a>() )
                setText( "This is not a pixmap" );
            else
                setText( "This is a pixmap" );
        }
    };

  //...

  int main( int argc, char** argv )
  {
    Preview* p = new Preview;

    QFileDialog* fd = new QFileDialog( this );
    fd-&gt;<a href="#setInfoPreviewEnabled">setInfoPreviewEnabled</a>( TRUE );
    fd-&gt;<a href="#setInfoPreview">setInfoPreview</a>( p, p );
    fd-&gt;<a href="#setPreviewMode">setPreviewMode</a>( QFileDialog::<a href="#PreviewMode-enum">Info</a> );
    fd-&gt;<a href="qdialog.html#show">show</a>();
  }

  </pre>
 
<p> <p>See also <a href="#setContentsPreview">setContentsPreview</a>(), <a href="#infoPreview-prop">infoPreview</a> and <a href="#previewMode-prop">previewMode</a>.

<p> 
<h3 class=fn>void <a name="setInfoPreviewEnabled"></a>QFileDialog::setInfoPreviewEnabled ( bool )
</h3><p>Sets whether the file dialog offers the possibility to preview information about the currently selected file.
See the <a href="qfiledialog.html#infoPreview-prop">"infoPreview"</a> property for details.
<h3 class=fn>void <a name="setMode"></a>QFileDialog::setMode ( <a href="qfiledialog.html#Mode-enum">Mode</a> )
</h3><p>Sets the file dialog's mode.
See the <a href="qfiledialog.html#mode-prop">"mode"</a> property for details.
<h3 class=fn>void <a name="setPreviewMode"></a>QFileDialog::setPreviewMode ( <a href="qfiledialog.html#PreviewMode-enum">PreviewMode</a>&nbsp;m )
</h3><p>Sets the preview mode for the file dialog to <em>m</em>.
See the <a href="qfiledialog.html#previewMode-prop">"previewMode"</a> property for details.
<h3 class=fn>void <a name="setSelectedFilter"></a>QFileDialog::setSelectedFilter ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;mask )<tt> [virtual]</tt>
</h3>
Sets the current filter selected in the file dialog to the first
one that contains the text <em>mask</em>.

<h3 class=fn>void <a name="setSelectedFilter-2"></a>QFileDialog::setSelectedFilter ( int&nbsp;n )<tt> [virtual]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the current filter selected in the file dialog to the
<em>n</em> filter in the filter list.
<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>.

<h3 class=fn>void <a name="setSelection"></a>QFileDialog::setSelection ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filename )
</h3>
Sets the default selection to <em>filename</em>.  If <em>filename</em> is
absolute, <a href="#setDir">setDir</a>() is also called to set the file dialog's working
directory to the filename's directory.
<p> 

<p>Example: <a href="qdir-example.html#x779">qdir/qdir.cpp</a>.
<h3 class=fn>void <a name="setShowHiddenFiles"></a>QFileDialog::setShowHiddenFiles ( bool&nbsp;s )
</h3><p>Sets whether hidden files are shown in the file dialog to <em>s</em>.
See the <a href="qfiledialog.html#showHiddenFiles-prop">"showHiddenFiles"</a> property for details.
<h3 class=fn>void <a name="setUrl"></a>QFileDialog::setUrl ( const&nbsp;<a href="qurloperator.html">QUrlOperator</a>&nbsp;&amp;&nbsp;url )<tt> [slot]</tt>
</h3>
Sets the file dialog's working directory to the directory specified at <em>url</em>.
<p> <p>See also <a href="#url">url</a>().

<h3 class=fn>void <a name="setViewMode"></a>QFileDialog::setViewMode ( <a href="qfiledialog.html#ViewMode-enum">ViewMode</a>&nbsp;m )
</h3><p>Sets the file dialog's view mode to <em>m</em>.
See the <a href="qfiledialog.html#viewMode-prop">"viewMode"</a> property for details.
<h3 class=fn>bool <a name="showHiddenFiles"></a>QFileDialog::showHiddenFiles () const
</h3><p>Returns TRUE if hidden files are shown in the file dialog; otherwise returns FALSE.
See the <a href="qfiledialog.html#showHiddenFiles-prop">"showHiddenFiles"</a> property for details.
<h3 class=fn><a href="qurl.html">QUrl</a> <a name="url"></a>QFileDialog::url () const
</h3>
Returns the URL of the current working directory in the file dialog.
<p> <p>See also <a href="#setUrl">setUrl</a>().

<p>Example: <a href="qdialog.html#x31">network/networkprotocol/view.cpp</a>.
<h3 class=fn><a href="qfiledialog.html#ViewMode-enum">ViewMode</a> <a name="viewMode"></a>QFileDialog::viewMode () const
</h3><p>Returns the file dialog's view mode.
See the <a href="qfiledialog.html#viewMode-prop">"viewMode"</a> property for details.
<hr><h2>Property Documentation</h2>
<h3 class=fn>bool <a name="contentsPreview-prop"></a>contentsPreview</h3>
<p>This property holds whether the file dialog offers the possibility of previewing the contents of the currently selected file.
<p>The default is FALSE.
<p> <p>See also <a href="#setContentsPreview">setContentsPreview</a>() and <a href="#infoPreview-prop">infoPreview</a>.

<p>Set this property's value with <a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>() and get this property's value with <a href="#isContentsPreviewEnabled">isContentsPreviewEnabled</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="dirPath-prop"></a>dirPath</h3>
<p>This property holds the file dialog's working directory.
<p>Get this property's value with <a href="#dirPath">dirPath</a>().
<p><p>See also <a href="#dir">dir</a>() and <a href="#setDir">setDir</a>().

<h3 class=fn>bool <a name="infoPreview-prop"></a>infoPreview</h3>
<p>This property holds whether the file dialog offers the possibility to preview information about the currently selected file.
<p>The default is FALSE.

<p>Set this property's value with <a href="#setInfoPreviewEnabled">setInfoPreviewEnabled</a>() and get this property's value with <a href="#isInfoPreviewEnabled">isInfoPreviewEnabled</a>().
<h3 class=fn><a href="qfiledialog.html#Mode-enum">Mode</a> <a name="mode-prop"></a>mode</h3>
<p>This property holds the file dialog's mode.
<p>The default mode is <a href="#Mode-enum">ExistingFile</a>.

<p>Set this property's value with <a href="#setMode">setMode</a>() and get this property's value with <a href="#mode">mode</a>().
<h3 class=fn><a href="qfiledialog.html#PreviewMode-enum">PreviewMode</a> <a name="previewMode-prop"></a>previewMode</h3>
<p>This property holds the preview mode for the file dialog.
<p>If you set the mode to be a mode other than <em>NoPreview</em>, then use
<a href="#setInfoPreview">setInfoPreview</a>() or <a href="#setContentsPreview">setContentsPreview</a>() to set the dialog's preview
widget to your preview widget and enable the preview widget(s) with
<a href="#setInfoPreviewEnabled">setInfoPreviewEnabled</a>() or <a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>().
<p> <p>See also <a href="#infoPreview-prop">infoPreview</a>, <a href="#contentsPreview-prop">contentsPreview</a> and <a href="#viewMode-prop">viewMode</a>.

<p>Set this property's value with <a href="#setPreviewMode">setPreviewMode</a>() and get this property's value with <a href="#previewMode">previewMode</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedFile-prop"></a>selectedFile</h3>
<p>This property holds the name of the selected file.
<p>If a file was selected selectedFile contains the file's name including
its absolute path; otherwise selectedFile is empty.
<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>.

<p>Get this property's value with <a href="#selectedFile">selectedFile</a>().
<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="selectedFiles-prop"></a>selectedFiles</h3>
<p>This property holds a list of selected files.
<p>If one or more files were selected selectedFiles contains the
names of the selected files including their absolute paths. If no
files were selected or the mode wasn't ExistingFiles selectedFiles
is an empty list.
<p> It is more convenient to use <a href="#selectedFile">selectedFile</a>() if the mode is
<a href="#Mode-enum">ExistingFile</a>, <a href="#Mode-enum">Directory</a> or <a href="#Mode-enum">DirectoryOnly</a>.
<p> Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
<pre>
    <a href="qstringlist.html">QStringList</a> list = myFileDialog.selectedFiles();
    QStringList::Iterator it = list.<a href="qvaluelist.html#begin">begin</a>();
    while( it != list.<a href="qvaluelist.html#end">end</a>() ) {
        myProcessing( *it );
        ++it;
    }
    </pre>
 
<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>().

<p>Get this property's value with <a href="#selectedFiles">selectedFiles</a>().
<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedFilter-prop"></a>selectedFilter</h3>
<p>This property holds the filter which the user has selected in the file dialog.
<p>Get this property's value with <a href="#selectedFilter">selectedFilter</a>().
<p><p>See also <a href="#filterSelected">filterSelected</a>(), <a href="#selectedFiles-prop">selectedFiles</a> and <a href="#selectedFile-prop">selectedFile</a>.

<h3 class=fn>bool <a name="showHiddenFiles-prop"></a>showHiddenFiles</h3>
<p>This property holds whether hidden files are shown in the file dialog.
<p>The default is FALSE, i.e. don't show hidden files.

<p>Set this property's value with <a href="#setShowHiddenFiles">setShowHiddenFiles</a>() and get this property's value with <a href="#showHiddenFiles">showHiddenFiles</a>().
<h3 class=fn><a href="qfiledialog.html#ViewMode-enum">ViewMode</a> <a name="viewMode-prop"></a>viewMode</h3>
<p>This property holds the file dialog's view mode.
<p>If you set the view mode to be <em>Detail</em> (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 alongside the file.
<p> If you set the view mode to be <em>List</em>, then you will just
see a list of the files and folders.
<p> See <a href="#ViewMode-enum">QFileDialog::ViewMode</a>

<p>Set this property's value with <a href="#setViewMode">setViewMode</a>() and get this property's value with <a href="#viewMode">viewMode</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>