You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
908 lines
58 KiB
908 lines
58 KiB
14 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/dialogs/qfiledialog.cpp:2159 -->
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>QFileDialog Class</title>
|
||
|
<style type="text/css"><!--
|
||
|
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 Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped 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 <<a href="qfiledialog-h.html">qfiledialog.h</a>></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 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>
|
||
|
<li class=fn><a href="#QFileDialog-2"><b>QFileDialog</b></a> ( QWidget * parent = 0, const char * name = 0, bool modal = FALSE )</li>
|
||
|
<li class=fn><a href="#~QFileDialog"><b>~QFileDialog</b></a> ()</li>
|
||
|
<li class=fn>QString <a href="#selectedFile"><b>selectedFile</b></a> () const</li>
|
||
|
<li class=fn>QString <a href="#selectedFilter"><b>selectedFilter</b></a> () const</li>
|
||
|
<li class=fn>virtual void <a href="#setSelectedFilter"><b>setSelectedFilter</b></a> ( const QString & mask )</li>
|
||
|
<li class=fn>virtual void <a href="#setSelectedFilter-2"><b>setSelectedFilter</b></a> ( int n )</li>
|
||
|
<li class=fn>void <a href="#setSelection"><b>setSelection</b></a> ( const QString & filename )</li>
|
||
|
<li class=fn>void <a href="#selectAll"><b>selectAll</b></a> ( bool b )</li>
|
||
|
<li class=fn>QStringList <a href="#selectedFiles"><b>selectedFiles</b></a> () const</li>
|
||
|
<li class=fn>QString <a href="#dirPath"><b>dirPath</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setDir"><b>setDir</b></a> ( const QDir & dir )</li>
|
||
|
<li class=fn>const QDir * <a href="#dir"><b>dir</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setShowHiddenFiles"><b>setShowHiddenFiles</b></a> ( bool s )</li>
|
||
|
<li class=fn>bool <a href="#showHiddenFiles"><b>showHiddenFiles</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#rereadDir"><b>rereadDir</b></a> ()</li>
|
||
|
<li class=fn>void <a href="#resortDir"><b>resortDir</b></a> ()</li>
|
||
|
<li class=fn>enum <a href="#Mode-enum"><b>Mode</b></a> { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly }</li>
|
||
|
<li class=fn>void <a href="#setMode"><b>setMode</b></a> ( Mode )</li>
|
||
|
<li class=fn>Mode <a href="#mode"><b>mode</b></a> () const</li>
|
||
|
<li class=fn>enum <a href="#ViewMode-enum"><b>ViewMode</b></a> { Detail, List }</li>
|
||
|
<li class=fn>enum <a href="#PreviewMode-enum"><b>PreviewMode</b></a> { NoPreview, Contents, Info }</li>
|
||
|
<li class=fn>void <a href="#setViewMode"><b>setViewMode</b></a> ( ViewMode m )</li>
|
||
|
<li class=fn>ViewMode <a href="#viewMode"><b>viewMode</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setPreviewMode"><b>setPreviewMode</b></a> ( PreviewMode m )</li>
|
||
|
<li class=fn>PreviewMode <a href="#previewMode"><b>previewMode</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isInfoPreviewEnabled"><b>isInfoPreviewEnabled</b></a> () const</li>
|
||
|
<li class=fn>bool <a href="#isContentsPreviewEnabled"><b>isContentsPreviewEnabled</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#setInfoPreviewEnabled"><b>setInfoPreviewEnabled</b></a> ( bool )</li>
|
||
|
<li class=fn>void <a href="#setContentsPreviewEnabled"><b>setContentsPreviewEnabled</b></a> ( bool )</li>
|
||
|
<li class=fn>void <a href="#setInfoPreview"><b>setInfoPreview</b></a> ( QWidget * w, QFilePreview * preview )</li>
|
||
|
<li class=fn>void <a href="#setContentsPreview"><b>setContentsPreview</b></a> ( QWidget * w, QFilePreview * preview )</li>
|
||
|
<li class=fn>QUrl <a href="#url"><b>url</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#addFilter"><b>addFilter</b></a> ( const QString & filter )</li>
|
||
|
</ul>
|
||
|
<h2>Public Slots</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#setDir-2"><b>setDir</b></a> ( const QString & pathstr )</li>
|
||
|
<li class=fn>void <a href="#setUrl"><b>setUrl</b></a> ( const QUrlOperator & url )</li>
|
||
|
<li class=fn>void <a href="#setFilter"><b>setFilter</b></a> ( const QString & newFilter )</li>
|
||
|
<li class=fn>void <a href="#setFilters"><b>setFilters</b></a> ( const QString & filters )</li>
|
||
|
<li class=fn>void <a href="#setFilters-2"><b>setFilters</b></a> ( const char ** types )</li>
|
||
|
<li class=fn>void <a href="#setFilters-3"><b>setFilters</b></a> ( const QStringList & )</li>
|
||
|
</ul>
|
||
|
<h2>Signals</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#fileHighlighted"><b>fileHighlighted</b></a> ( const QString & )</li>
|
||
|
<li class=fn>void <a href="#fileSelected"><b>fileSelected</b></a> ( const QString & )</li>
|
||
|
<li class=fn>void <a href="#filesSelected"><b>filesSelected</b></a> ( const QStringList & )</li>
|
||
|
<li class=fn>void <a href="#dirEntered"><b>dirEntered</b></a> ( const QString & )</li>
|
||
|
<li class=fn>void <a href="#filterSelected"><b>filterSelected</b></a> ( const QString & )</li>
|
||
|
</ul>
|
||
|
<h2>Static Public Members</h2>
|
||
|
<ul>
|
||
|
<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>
|
||
|
<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>
|
||
|
<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>
|
||
|
<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>
|
||
|
<li class=fn>void <a href="#setIconProvider"><b>setIconProvider</b></a> ( QFileIconProvider * provider )</li>
|
||
|
<li class=fn>QFileIconProvider * <a href="#iconProvider"><b>iconProvider</b></a> ()</li>
|
||
|
</ul>
|
||
|
<h2>Properties</h2>
|
||
|
<ul>
|
||
|
<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>
|
||
|
<li class=fn>QString <a href="#dirPath-prop"><b>dirPath</b></a> - the file dialog's working directory <em>(read only)</em></li>
|
||
|
<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>
|
||
|
<li class=fn>Mode <a href="#mode-prop"><b>mode</b></a> - the file dialog's mode</li>
|
||
|
<li class=fn>PreviewMode <a href="#previewMode-prop"><b>previewMode</b></a> - the preview mode for the file dialog</li>
|
||
|
<li class=fn>QString <a href="#selectedFile-prop"><b>selectedFile</b></a> - the name of the selected file <em>(read only)</em></li>
|
||
|
<li class=fn>QStringList <a href="#selectedFiles-prop"><b>selectedFiles</b></a> - the list of selected files <em>(read only)</em></li>
|
||
|
<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>
|
||
|
<li class=fn>bool <a href="#showHiddenFiles-prop"><b>showHiddenFiles</b></a> - whether hidden files are shown in the file dialog</li>
|
||
|
<li class=fn>ViewMode <a href="#viewMode-prop"><b>viewMode</b></a> - the file dialog's view mode</li>
|
||
|
</ul>
|
||
|
<h2>Protected Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn>void <a href="#addWidgets"><b>addWidgets</b></a> ( QLabel * l, QWidget * w, QPushButton * b )</li>
|
||
|
<li class=fn>void <a href="#addToolButton"><b>addToolButton</b></a> ( QButton * b, bool separator = FALSE )</li>
|
||
|
<li class=fn>void <a href="#addLeftWidget"><b>addLeftWidget</b></a> ( QWidget * w )</li>
|
||
|
<li class=fn>void <a href="#addRightWidget"><b>addRightWidget</b></a> ( QWidget * w )</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". If you want to use multiple filters, separate each one with
|
||
|
<em>two</em> semi-colons, e.g.
|
||
|
<pre>
|
||
|
"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
|
||
|
</pre>
|
||
|
|
||
|
<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-><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 may 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->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> will be shown 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 alongside each name, e.g. file size,
|
||
|
modification date, etc. Set the mode with <a href="#setViewMode">setViewMode</a>().
|
||
|
<p> <pre>
|
||
|
fd->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->exec() == QDialog::<a href="qdialog.html#DialogCode-enum">Accepted</a> )
|
||
|
fileName = fd->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>
|
||
|
<a name="1"></a><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> &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
|
||
|
above example we only show a preview of the file if it is a valid
|
||
|
pixmap. Here's how to make a file dialog use a preview widget:
|
||
|
<p> <pre>
|
||
|
Preview* p = new Preview;
|
||
|
|
||
|
QFileDialog* fd = new QFileDialog( this );
|
||
|
fd-><a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE );
|
||
|
fd-><a href="#setContentsPreview">setContentsPreview</a>( p, p );
|
||
|
fd-><a href="#setPreviewMode">setPreviewMode</a>( QFileDialog::<a href="#PreviewMode-enum">Contents</a> );
|
||
|
fd-><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 preview of 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 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
|
||
|
<a href="qfilepreview.html">QFilePreview</a>.
|
||
|
<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 will be displayed.
|
||
|
<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, such as file size and 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 <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 )
|
||
|
</h3>
|
||
|
Constructs a file dialog called <em>name</em> with the parent, <em>parent</em>.
|
||
|
If <em>modal</em> is TRUE then the file dialog is modal; otherwise it is
|
||
|
modeless.
|
||
|
<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> * parent = 0, const char * name = 0, bool modal = FALSE )
|
||
|
</h3>
|
||
|
Constructs a file dialog called <em>name</em>, with the parent, <em>parent</em>.
|
||
|
If <em>modal</em> is TRUE then the file dialog is modal; otherwise it is
|
||
|
modeless.
|
||
|
|
||
|
<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 <a href="qstring.html">QString</a> & filter )
|
||
|
</h3>
|
||
|
Adds the filter <em>filter</em> to the list of filters and makes it the
|
||
|
current filter.
|
||
|
<p> <pre>
|
||
|
QFileDialog* fd = new QFileDialog( this );
|
||
|
fd-><a href="#addFilter">addFilter</a>( "Images (*.png *.jpg *.xpm)" );
|
||
|
fd-><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> * 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> * 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> * b, bool 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> * l, <a href="qwidget.html">QWidget</a> * w, <a href="qpushbutton.html">QPushButton</a> * b )<tt> [protected]</tt>
|
||
|
</h3>
|
||
|
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> <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="qpushbutton.html">QPushButton</a>* pushbutton = new <a href="qpushbutton.html">QPushButton</a>( this );
|
||
|
|
||
|
<a href="#addWidgets">addWidgets</a>( label, lineedit, pushbutton );
|
||
|
}
|
||
|
</pre>
|
||
|
|
||
|
<p> If you don't want to have one of the widgets added, pass 0 in that
|
||
|
widget's position.
|
||
|
<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 <a href="qdir.html">QDir</a> * <a name="dir"></a>QFileDialog::dir () const
|
||
|
</h3>
|
||
|
Returns the current directory shown in the file dialog.
|
||
|
<p> The ownership of the <a href="qdir.html">QDir</a> pointer is transferred to the caller, so
|
||
|
it must be deleted by the caller when no longer required.
|
||
|
<p> <p>See also <a href="#setDir">setDir</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="dirEntered"></a>QFileDialog::dirEntered ( const <a href="qstring.html">QString</a> & )<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 <a href="qstring.html">QString</a> & )<tt> [signal]</tt>
|
||
|
</h3>
|
||
|
|
||
|
<p> This signal is emitted when the user highlights a file, i.e. makes
|
||
|
it the current 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 <a href="qstring.html">QString</a> & )<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 <a href="qstringlist.html">QStringList</a> & )<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 <a href="qstring.html">QString</a> & )<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 <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>
|
||
|
</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 called <em>name</em>, with
|
||
|
parent, <em>parent</em>. If parent is not 0, 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> Note on Windows that if <em>dir</em> is QString::null then the dialog's working
|
||
|
directory will be set to the user's My Documents directory.
|
||
|
<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> Under Windows and Mac OS X, this static function will use the native
|
||
|
file dialog and not a QFileDialog, unless the style of the application
|
||
|
is set to something other than the native style. (Note that on Windows the
|
||
|
dialog will spin a blocking modal event loop that will not dispatch any
|
||
|
QTimers and if parent is not 0 then it will position the dialog just under
|
||
|
the parent's titlebar).
|
||
|
<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 <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>
|
||
|
</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 to open" );
|
||
|
</pre>
|
||
|
|
||
|
<p> The function creates a modal file dialog called <em>name</em>, with
|
||
|
parent, <em>parent</em>. If a parent is not 0, 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 (Note that on Windows the
|
||
|
dialog will spin a blocking modal event loop that will not dispatch any
|
||
|
QTimers and if parent is not 0 then it will position the dialog just under
|
||
|
the parent's titlebar).
|
||
|
<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#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>.
|
||
|
<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>
|
||
|
</h3>
|
||
|
This is a convenience static function that will return one or more
|
||
|
existing files 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 to open" );
|
||
|
</pre>
|
||
|
|
||
|
<p> This function creates a modal file dialog called <em>name</em>, with
|
||
|
parent <em>parent</em>. If <em>parent</em> is not 0, 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. (Note that on Windows the
|
||
|
dialog will spin a blocking modal event loop that will not dispatch any
|
||
|
QTimers and if parent is not 0 then it will position the dialog just under
|
||
|
the parent's titlebar).
|
||
|
<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 of files, 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 <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>
|
||
|
</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 called <em>name</em>, with parent, <em>parent</em>.
|
||
|
If a parent is not 0, 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 filename to save under" );
|
||
|
</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. (Note that on Windows the
|
||
|
dialog will spin a blocking modal event loop that will not dispatch any
|
||
|
QTimers and if parent is not 0 then it will position the dialog just under
|
||
|
the parent's titlebar.
|
||
|
<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#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>.
|
||
|
<h3 class=fn><a href="qfileiconprovider.html">QFileIconProvider</a> * <a name="iconProvider"></a>QFileDialog::iconProvider ()<tt> [static]</tt>
|
||
|
</h3>
|
||
|
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 can provide a contents preview 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 can provide 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 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 the 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> * w, <a href="qfilepreview.html">QFilePreview</a> * 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. If you
|
||
|
don't, you must remember to delete the preview object in order to
|
||
|
avoid memory leaks.
|
||
|
<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> &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-><a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE );
|
||
|
fd-><a href="#setContentsPreview">setContentsPreview</a>( p, p );
|
||
|
fd-><a href="#setPreviewMode">setPreviewMode</a>( QFileDialog::<a href="#PreviewMode-enum">Contents</a> );
|
||
|
fd-><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#x1817">qdir/qdir.cpp</a>.
|
||
|
<h3 class=fn>void <a name="setContentsPreviewEnabled"></a>QFileDialog::setContentsPreviewEnabled ( bool )
|
||
|
</h3><p>Sets whether the file dialog can provide a contents preview 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 <a href="qdir.html">QDir</a> & 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 <a href="qstring.html">QString</a> & 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 <a href="qstring.html">QString</a> & 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->setFilter( "All C++ files (*.cpp *.cc *.C *.cxx *.c++)" );
|
||
|
fd->setFilter( "*.cpp *.cc *.C *.cxx *.c++" );
|
||
|
fd->setFilter( "All C++ files (*.cpp;*.cc;*.C;*.cxx;*.c++)" );
|
||
|
fd->setFilter( "*.cpp;*.cc;*.C;*.cxx;*.c++" );
|
||
|
</pre>
|
||
|
|
||
|
<p> <p>See also <a href="#setFilters">setFilters</a>().
|
||
|
|
||
|
<h3 class=fn>void <a name="setFilters"></a>QFileDialog::setFilters ( const <a href="qstring.html">QString</a> & 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> (<em>two</em> semi-colons).
|
||
|
<p> <pre>
|
||
|
<a href="qstring.html">QString</a> types("Image files (*.png *.xpm *.jpg);;"
|
||
|
"Text files (*.txt);;"
|
||
|
"Any files (*)");
|
||
|
QFileDialog fd = new QFileDialog( this );
|
||
|
fd-><a href="#setFilters">setFilters</a>( types );
|
||
|
fd-><a href="qdialog.html#show">show</a>();
|
||
|
</pre>
|
||
|
|
||
|
<p>
|
||
|
<h3 class=fn>void <a name="setFilters-2"></a>QFileDialog::setFilters ( const char ** 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 <a href="qstringlist.html">QStringList</a> & )<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> * provider )<tt> [static]</tt>
|
||
|
</h3>
|
||
|
Sets the <a href="qfileiconprovider.html">QFileIconProvider</a> used by the file dialog to <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 files.
|
||
|
<p> <p>See also <a href="qfileiconprovider.html">QFileIconProvider</a> and <a href="#iconProvider">iconProvider</a>().
|
||
|
|
||
|
<p>Example: <a href="showimg-example.html#x1362">showimg/main.cpp</a>.
|
||
|
<h3 class=fn>void <a name="setInfoPreview"></a>QFileDialog::setInfoPreview ( <a href="qwidget.html">QWidget</a> * w, <a href="qfilepreview.html">QFilePreview</a> * 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. If you
|
||
|
don't, you must remember to delete the preview object in order to
|
||
|
avoid memory leaks.
|
||
|
<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> &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-><a href="#setInfoPreviewEnabled">setInfoPreviewEnabled</a>( TRUE );
|
||
|
fd-><a href="#setInfoPreview">setInfoPreview</a>( p, p );
|
||
|
fd-><a href="#setPreviewMode">setPreviewMode</a>( QFileDialog::<a href="#PreviewMode-enum">Info</a> );
|
||
|
fd-><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 can provide 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> 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 <a href="qstring.html">QString</a> & 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 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>-th 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 <a href="qstring.html">QString</a> & 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#x1821">qdir/qdir.cpp</a>.
|
||
|
<h3 class=fn>void <a name="setShowHiddenFiles"></a>QFileDialog::setShowHiddenFiles ( bool 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 <a href="qurloperator.html">QUrlOperator</a> & 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> 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#x2129">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 can provide a contents preview 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 can provide 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>, you must
|
||
|
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 the list of selected files.
|
||
|
<p>If one or more files are selected, selectedFiles contains their
|
||
|
names including their absolute paths. If no files are selected or
|
||
|
the mode isn't ExistingFiles selectedFiles is an empty list.
|
||
|
<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 in addition to the file's name.
|
||
|
<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 © 1995-2007
|
||
|
<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 © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>Qt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|