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.
tqt3/doc/html/ntqfiledialog.html

908 lines
59 KiB

<!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>TQFileDialog 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&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>TQFileDialog Class Reference</h1>
<p>The TQFileDialog 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">ntqfiledialog.h</a>&gt;</tt>
<p>Inherits <a href="ntqdialog.html">TQDialog</a>.
<p><a href="qfiledialog-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQFileDialog"><b>TQFileDialog</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;dirName, const&nbsp;TQString&nbsp;&amp;&nbsp;filter = TQString::null, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = FALSE )</li>
<li class=fn><a href="#TQFileDialog-2"><b>TQFileDialog</b></a> ( TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = FALSE )</li>
<li class=fn><a href="#~TQFileDialog"><b>~TQFileDialog</b></a> ()</li>
<li class=fn>TQString <a href="#selectedFile"><b>selectedFile</b></a> () const</li>
<li class=fn>TQString <a href="#selectedFilter"><b>selectedFilter</b></a> () const</li>
<li class=fn>virtual void <a href="#setSelectedFilter"><b>setSelectedFilter</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;mask )</li>
<li class=fn>virtual void <a href="#setSelectedFilter-2"><b>setSelectedFilter</b></a> ( int&nbsp;n )</li>
<li class=fn>void <a href="#setSelection"><b>setSelection</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;filename )</li>
<li class=fn>void <a href="#selectAll"><b>selectAll</b></a> ( bool&nbsp;b )</li>
<li class=fn>TQStringList <a href="#selectedFiles"><b>selectedFiles</b></a> () const</li>
<li class=fn>TQString <a href="#dirPath"><b>dirPath</b></a> () const</li>
<li class=fn>void <a href="#setDir"><b>setDir</b></a> ( const&nbsp;TQDir&nbsp;&amp;&nbsp;dir )</li>
<li class=fn>const TQDir * <a href="#dir"><b>dir</b></a> () const</li>
<li class=fn>void <a href="#setShowHiddenFiles"><b>setShowHiddenFiles</b></a> ( bool&nbsp;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&nbsp;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&nbsp;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> ( TQWidget&nbsp;*&nbsp;w, TQFilePreview&nbsp;*&nbsp;preview )</li>
<li class=fn>void <a href="#setContentsPreview"><b>setContentsPreview</b></a> ( TQWidget&nbsp;*&nbsp;w, TQFilePreview&nbsp;*&nbsp;preview )</li>
<li class=fn>TQUrl <a href="#url"><b>url</b></a> () const</li>
<li class=fn>void <a href="#addFilter"><b>addFilter</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;filter )</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>void <a href="#setDir-2"><b>setDir</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;pathstr )</li>
<li class=fn>void <a href="#setUrl"><b>setUrl</b></a> ( const&nbsp;TQUrlOperator&nbsp;&amp;&nbsp;url )</li>
<li class=fn>void <a href="#setFilter"><b>setFilter</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;newFilter )</li>
<li class=fn>void <a href="#setFilters"><b>setFilters</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;filters )</li>
<li class=fn>void <a href="#setFilters-2"><b>setFilters</b></a> ( const&nbsp;char&nbsp;**&nbsp;types )</li>
<li class=fn>void <a href="#setFilters-3"><b>setFilters</b></a> ( const TQStringList &amp; )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#fileHighlighted"><b>fileHighlighted</b></a> ( const TQString &amp; )</li>
<li class=fn>void <a href="#fileSelected"><b>fileSelected</b></a> ( const TQString &amp; )</li>
<li class=fn>void <a href="#filesSelected"><b>filesSelected</b></a> ( const TQStringList &amp; )</li>
<li class=fn>void <a href="#dirEntered"><b>dirEntered</b></a> ( const TQString &amp; )</li>
<li class=fn>void <a href="#filterSelected"><b>filterSelected</b></a> ( const TQString &amp; )</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>TQString <a href="#getOpenFileName"><b>getOpenFileName</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;startWith = TQString::null, const&nbsp;TQString&nbsp;&amp;&nbsp;filter = TQString::null, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;TQString&nbsp;&amp;&nbsp;caption = TQString::null, TQString&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )</li>
<li class=fn>TQString <a href="#getSaveFileName"><b>getSaveFileName</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;startWith = TQString::null, const&nbsp;TQString&nbsp;&amp;&nbsp;filter = TQString::null, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;TQString&nbsp;&amp;&nbsp;caption = TQString::null, TQString&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )</li>
<li class=fn>TQString <a href="#getExistingDirectory"><b>getExistingDirectory</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;dir = TQString::null, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;TQString&nbsp;&amp;&nbsp;caption = TQString::null, bool&nbsp;dirOnly = TRUE, bool&nbsp;resolveSymlinks = TRUE )</li>
<li class=fn>TQStringList <a href="#getOpenFileNames"><b>getOpenFileNames</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;filter = TQString::null, const&nbsp;TQString&nbsp;&amp;&nbsp;dir = TQString::null, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;TQString&nbsp;&amp;&nbsp;caption = TQString::null, TQString&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )</li>
<li class=fn>void <a href="#setIconProvider"><b>setIconProvider</b></a> ( TQFileIconProvider&nbsp;*&nbsp;provider )</li>
<li class=fn>TQFileIconProvider * <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>&nbsp;- whether the file dialog can provide a contents preview of the currently selected file</li>
<li class=fn>TQString <a href="#dirPath-prop"><b>dirPath</b></a>&nbsp;- the file dialog's working directory &nbsp;<em>(read only)</em></li>
<li class=fn>bool <a href="#infoPreview-prop"><b>infoPreview</b></a>&nbsp;- 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>&nbsp;- the file dialog's mode</li>
<li class=fn>PreviewMode <a href="#previewMode-prop"><b>previewMode</b></a>&nbsp;- the preview mode for the file dialog</li>
<li class=fn>TQString <a href="#selectedFile-prop"><b>selectedFile</b></a>&nbsp;- the name of the selected file &nbsp;<em>(read only)</em></li>
<li class=fn>TQStringList <a href="#selectedFiles-prop"><b>selectedFiles</b></a>&nbsp;- the list of selected files &nbsp;<em>(read only)</em></li>
<li class=fn>TQString <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></li>
<li class=fn>bool <a href="#showHiddenFiles-prop"><b>showHiddenFiles</b></a>&nbsp;- whether hidden files are shown in the file dialog</li>
<li class=fn>ViewMode <a href="#viewMode-prop"><b>viewMode</b></a>&nbsp;- the file dialog's view mode</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>void <a href="#addWidgets"><b>addWidgets</b></a> ( TQLabel&nbsp;*&nbsp;l, TQWidget&nbsp;*&nbsp;w, TQPushButton&nbsp;*&nbsp;b )</li>
<li class=fn>void <a href="#addToolButton"><b>addToolButton</b></a> ( TQButton&nbsp;*&nbsp;b, bool&nbsp;separator = FALSE )</li>
<li class=fn>void <a href="#addLeftWidget"><b>addLeftWidget</b></a> ( TQWidget&nbsp;*&nbsp;w )</li>
<li class=fn>void <a href="#addRightWidget"><b>addRightWidget</b></a> ( TQWidget&nbsp;*&nbsp;w )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQFileDialog class provides dialogs that allow users to select files or directories.
<p> The TQFileDialog 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 TQFileDialog 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="ntqstring.html">TQString</a> s = TQFileDialog::<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 TQFileDialog 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 TQFileDialog without using the static
functions. By calling <a href="#setMode">setMode</a>(), you can set what can be returned by
the TQFileDialog.
<p> <pre>
TQFileDialog* fd = new TQFileDialog( this, "file dialog", TRUE );
fd-&gt;<a href="#setMode">setMode</a>( TQFileDialog::<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">TQFileDialog::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> will be shown in the TQFileDialog. 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, TQFileDialog::List which simply
lists file and directory names and TQFileDialog::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-&gt;setViewMode( TQFileDialog::<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="ntqstring.html">TQString</a> fileName;
if ( fd-&gt;exec() == TQDialog::<a href="ntqdialog.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="ntqstringlist.html">TQStringList</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
TQFileDialogs: <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 TQFileDialog so
that the user can see either the contents of the file, or information
about the file.
<p> <pre>
class Preview : public <a href="ntqlabel.html">TQLabel</a>, public TQFilePreview
{
public:
Preview( <a href="tqwidget.html">TQWidget</a> *parent=0 ) : <a href="ntqlabel.html">TQLabel</a>( parent ) {}
void previewUrl( const <a href="ntqurl.html">TQUrl</a> &amp;u )
{
<a href="ntqstring.html">TQString</a> path = u.<a href="ntqurl.html#path">path</a>();
<a href="ntqpixmap.html">TQPixmap</a> pix( path );
if ( pix.<a href="ntqpixmap.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="ntqlabel.html">TQLabel</a> and <a href="qfilepreview.html">TQFilePreview</a>. File preview widgets <em>must</em> inherit from
TQFilePreview.
<p> Inside the class we reimplement <a href="qfilepreview.html#previewUrl">TQFilePreview::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;
TQFileDialog* fd = new TQFileDialog( 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>( TQFileDialog::<a href="#PreviewMode-enum">Contents</a> );
fd-&gt;<a href="ntqdialog.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">TQFilePreview</a> widget see
<a href="qfilepreview.html">TQFilePreview</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>TQFileDialog::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>TQFileDialog::AnyFile</tt> - The name of a file, whether it exists or not.
<li><tt>TQFileDialog::ExistingFile</tt> - The name of a single existing file.
<li><tt>TQFileDialog::Directory</tt> - The name of a directory. Both files and directories
are displayed.
<li><tt>TQFileDialog::DirectoryOnly</tt> - The name of a directory. The file dialog will only display directories.
<li><tt>TQFileDialog::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>TQFileDialog::PreviewMode</h3>
<p> This enum describes the preview mode of the file dialog.
<ul>
<li><tt>TQFileDialog::NoPreview</tt> - No preview is shown at all.
<li><tt>TQFileDialog::Contents</tt> - Show a preview of the contents of the current file
using the contents preview widget.
<li><tt>TQFileDialog::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>TQFileDialog::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>TQFileDialog::List</tt> - Display file and directory names with icons.
<li><tt>TQFileDialog::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="TQFileDialog"></a>TQFileDialog::TQFileDialog ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;dirName, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;filter = TQString::null, <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;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="TQFileDialog-2"></a>TQFileDialog::TQFileDialog ( <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;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="~TQFileDialog"></a>TQFileDialog::~TQFileDialog ()
</h3>
Destroys the file dialog.
<h3 class=fn>void <a name="addFilter"></a>TQFileDialog::addFilter ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;filter )
</h3>
Adds the filter <em>filter</em> to the list of filters and makes it the
current filter.
<p> <pre>
TQFileDialog* fd = new TQFileDialog( this );
fd-&gt;<a href="#addFilter">addFilter</a>( "Images (*.png *.jpg *.xpm)" );
fd-&gt;<a href="ntqdialog.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>TQFileDialog::addLeftWidget ( <a href="tqwidget.html">TQWidget</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>TQFileDialog::addRightWidget ( <a href="tqwidget.html">TQWidget</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>TQFileDialog::addToolButton ( <a href="ntqbutton.html">TQButton</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>TQFileDialog::addWidgets ( <a href="ntqlabel.html">TQLabel</a>&nbsp;*&nbsp;l, <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;w, <a href="ntqpushbutton.html">TQPushButton</a>&nbsp;*&nbsp;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="tqwidget.html">TQWidget</a>* parent, const char* name ) :
<a href="#TQFileDialog">TQFileDialog</a>( parent, name )
{
<a href="ntqlabel.html">TQLabel</a>* label = new <a href="ntqlabel.html">TQLabel</a>( "Added widgets", this );
<a href="ntqlineedit.html">TQLineEdit</a>* lineedit = new <a href="ntqlineedit.html">TQLineEdit</a>( this );
<a href="ntqpushbutton.html">TQPushButton</a>* pushbutton = new <a href="ntqpushbutton.html">TQPushButton</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&nbsp;<a href="ntqdir.html">TQDir</a>&nbsp;* <a name="dir"></a>TQFileDialog::dir () const
</h3>
Returns the current directory shown in the file dialog.
<p> The ownership of the <a href="ntqdir.html">TQDir</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>TQFileDialog::dirEntered ( const&nbsp;<a href="ntqstring.html">TQString</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="ntqstring.html">TQString</a> <a name="dirPath"></a>TQFileDialog::dirPath () const
</h3><p>Returns the file dialog's working directory.
See the <a href="ntqfiledialog.html#dirPath-prop">"dirPath"</a> property for details.
<h3 class=fn>void <a name="fileHighlighted"></a>TQFileDialog::fileHighlighted ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp; )<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>TQFileDialog::fileSelected ( const&nbsp;<a href="ntqstring.html">TQString</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>TQFileDialog::filesSelected ( const&nbsp;<a href="ntqstringlist.html">TQStringList</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>TQFileDialog::filterSelected ( const&nbsp;<a href="ntqstring.html">TQString</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="ntqstring.html">TQString</a> <a name="getExistingDirectory"></a>TQFileDialog::getExistingDirectory ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;dir = TQString::null, <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;caption = TQString::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="ntqstring.html">TQString</a> s = TQFileDialog::<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="ntqstring.html#TQString-null">TQString::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 TQString::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 TQFileDialog, 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
TQTimers 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="ntqstring.html">TQString</a> <a name="getOpenFileName"></a>TQFileDialog::getOpenFileName ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;startWith = TQString::null, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;filter = TQString::null, <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;caption = TQString::null, <a href="ntqstring.html">TQString</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="ntqstring.html">TQString</a> s = TQFileDialog::<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="ntqstring.html#TQString-null">TQString::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 TQFileDialog, 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
TQTimers 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="ntqstringlist.html">TQStringList</a> <a name="getOpenFileNames"></a>TQFileDialog::getOpenFileNames ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;filter = TQString::null, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;dir = TQString::null, <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;caption = TQString::null, <a href="ntqstring.html">TQString</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 selected by the user.
<p> <pre>
<a href="ntqstringlist.html">TQStringList</a> files = TQFileDialog::<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="ntqstring.html#TQString-null">TQString::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 TQFileDialog, 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
TQTimers 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="ntqstringlist.html">TQStringList</a> list = files;
TQStringList::Iterator it = list.<a href="tqvaluelist.html#begin">begin</a>();
while( it != list.<a href="tqvaluelist.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="ntqstring.html">TQString</a> <a name="getSaveFileName"></a>TQFileDialog::getSaveFileName ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;startWith = TQString::null, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;filter = TQString::null, <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;caption = TQString::null, <a href="ntqstring.html">TQString</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 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="ntqstring.html">TQString</a> s = TQFileDialog::<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="ntqstring.html#TQString-null">TQString::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 TQFileDialog, 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
TQTimers 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">TQFileIconProvider</a>&nbsp;* <a name="iconProvider"></a>TQFileDialog::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">TQFileIconProvider</a>.
<h3 class=fn>bool <a name="isContentsPreviewEnabled"></a>TQFileDialog::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="ntqfiledialog.html#contentsPreview-prop">"contentsPreview"</a> property for details.
<h3 class=fn>bool <a name="isInfoPreviewEnabled"></a>TQFileDialog::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="ntqfiledialog.html#infoPreview-prop">"infoPreview"</a> property for details.
<h3 class=fn><a href="ntqfiledialog.html#Mode-enum">Mode</a> <a name="mode"></a>TQFileDialog::mode () const
</h3><p>Returns the file dialog's mode.
See the <a href="ntqfiledialog.html#mode-prop">"mode"</a> property for details.
<h3 class=fn><a href="ntqfiledialog.html#PreviewMode-enum">PreviewMode</a> <a name="previewMode"></a>TQFileDialog::previewMode () const
</h3><p>Returns the preview mode for the file dialog.
See the <a href="ntqfiledialog.html#previewMode-prop">"previewMode"</a> property for details.
<h3 class=fn>void <a name="rereadDir"></a>TQFileDialog::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>TQFileDialog::resortDir ()
</h3>
Re-sorts the displayed directory.
<p> <p>See also <a href="#rereadDir">rereadDir</a>().
<h3 class=fn>void <a name="selectAll"></a>TQFileDialog::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="ntqstring.html">TQString</a> <a name="selectedFile"></a>TQFileDialog::selectedFile () const
</h3><p>Returns the name of the selected file.
See the <a href="ntqfiledialog.html#selectedFile-prop">"selectedFile"</a> property for details.
<h3 class=fn><a href="ntqstringlist.html">TQStringList</a> <a name="selectedFiles"></a>TQFileDialog::selectedFiles () const
</h3><p>Returns the list of selected files.
See the <a href="ntqfiledialog.html#selectedFiles-prop">"selectedFiles"</a> property for details.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="selectedFilter"></a>TQFileDialog::selectedFilter () const
</h3><p>Returns the filter which the user has selected in the file dialog.
See the <a href="ntqfiledialog.html#selectedFilter-prop">"selectedFilter"</a> property for details.
<h3 class=fn>void <a name="setContentsPreview"></a>TQFileDialog::setContentsPreview ( <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;w, <a href="qfilepreview.html">TQFilePreview</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">TQFilePreview</a> <em>preview</em>.
<p> Normally you would create a preview widget that derives from both <a href="tqwidget.html">TQWidget</a> and
TQFilePreview, 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="ntqlabel.html">TQLabel</a>, public TQFilePreview
{
public:
Preview( <a href="tqwidget.html">TQWidget</a> *parent=0 ) : <a href="ntqlabel.html">TQLabel</a>( parent ) {}
void previewUrl( const <a href="ntqurl.html">TQUrl</a> &amp;u )
{
<a href="ntqstring.html">TQString</a> path = u.<a href="ntqurl.html#path">path</a>();
<a href="ntqpixmap.html">TQPixmap</a> pix( path );
if ( pix.<a href="ntqpixmap.html#isNull">isNull</a>() )
setText( "This is not a pixmap" );
else
setPixmap( pix );
}
};
//...
int main( int argc, char** argv )
{
Preview* p = new Preview;
TQFileDialog* fd = new TQFileDialog( 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>( TQFileDialog::<a href="#PreviewMode-enum">Contents</a> );
fd-&gt;<a href="ntqdialog.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>TQFileDialog::setContentsPreviewEnabled ( bool )
</h3><p>Sets whether the file dialog can provide a contents preview of the currently selected file.
See the <a href="ntqfiledialog.html#contentsPreview-prop">"contentsPreview"</a> property for details.
<h3 class=fn>void <a name="setDir"></a>TQFileDialog::setDir ( const&nbsp;<a href="ntqdir.html">TQDir</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>TQFileDialog::setDir ( const&nbsp;<a href="ntqstring.html">TQString</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>TQFileDialog::setFilter ( const&nbsp;<a href="ntqstring.html">TQString</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>TQFileDialog::setFilters ( const&nbsp;<a href="ntqstring.html">TQString</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> (<em>two</em> semi-colons).
<p> <pre>
<a href="ntqstring.html">TQString</a> types("Image files (*.png *.xpm *.jpg);;"
"Text files (*.txt);;"
"Any files (*)");
TQFileDialog fd = new TQFileDialog( this );
fd-&gt;<a href="#setFilters">setFilters</a>( types );
fd-&gt;<a href="ntqdialog.html#show">show</a>();
</pre>
<p>
<h3 class=fn>void <a name="setFilters-2"></a>TQFileDialog::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>TQFileDialog::setFilters ( const&nbsp;<a href="ntqstringlist.html">TQStringList</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>TQFileDialog::setIconProvider ( <a href="qfileiconprovider.html">TQFileIconProvider</a>&nbsp;*&nbsp;provider )<tt> [static]</tt>
</h3>
Sets the <a href="qfileiconprovider.html">TQFileIconProvider</a> used by the file dialog to <em>provider</em>.
<p> The default is that there is no TQFileIconProvider and TQFileDialog
just draws a folder icon next to each directory and nothing next
to files.
<p> <p>See also <a href="qfileiconprovider.html">TQFileIconProvider</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>TQFileDialog::setInfoPreview ( <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;w, <a href="qfilepreview.html">TQFilePreview</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">TQFilePreview</a> <em>preview</em>.
<p> Normally you would create a preview widget that derives from both <a href="tqwidget.html">TQWidget</a> and
TQFilePreview, 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="ntqlabel.html">TQLabel</a>, public TQFilePreview
{
public:
Preview( <a href="tqwidget.html">TQWidget</a> *parent=0 ) : <a href="ntqlabel.html">TQLabel</a>( parent ) {}
void previewUrl( const <a href="ntqurl.html">TQUrl</a> &amp;u )
{
<a href="ntqstring.html">TQString</a> path = u.<a href="ntqurl.html#path">path</a>();
<a href="ntqpixmap.html">TQPixmap</a> pix( path );
if ( pix.<a href="ntqpixmap.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;
TQFileDialog* fd = new TQFileDialog( 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>( TQFileDialog::<a href="#PreviewMode-enum">Info</a> );
fd-&gt;<a href="ntqdialog.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>TQFileDialog::setInfoPreviewEnabled ( bool )
</h3><p>Sets whether the file dialog can provide preview information about the currently selected file.
See the <a href="ntqfiledialog.html#infoPreview-prop">"infoPreview"</a> property for details.
<h3 class=fn>void <a name="setMode"></a>TQFileDialog::setMode ( <a href="ntqfiledialog.html#Mode-enum">Mode</a> )
</h3><p>Sets the file dialog's mode.
See the <a href="ntqfiledialog.html#mode-prop">"mode"</a> property for details.
<h3 class=fn>void <a name="setPreviewMode"></a>TQFileDialog::setPreviewMode ( <a href="ntqfiledialog.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="ntqfiledialog.html#previewMode-prop">"previewMode"</a> property for details.
<h3 class=fn>void <a name="setSelectedFilter"></a>TQFileDialog::setSelectedFilter ( const&nbsp;<a href="ntqstring.html">TQString</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>TQFileDialog::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>-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>TQFileDialog::setSelection ( const&nbsp;<a href="ntqstring.html">TQString</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#x1821">qdir/qdir.cpp</a>.
<h3 class=fn>void <a name="setShowHiddenFiles"></a>TQFileDialog::setShowHiddenFiles ( bool&nbsp;s )
</h3><p>Sets whether hidden files are shown in the file dialog to <em>s</em>.
See the <a href="ntqfiledialog.html#showHiddenFiles-prop">"showHiddenFiles"</a> property for details.
<h3 class=fn>void <a name="setUrl"></a>TQFileDialog::setUrl ( const&nbsp;<a href="ntqurloperator.html">TQUrlOperator</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>TQFileDialog::setViewMode ( <a href="ntqfiledialog.html#ViewMode-enum">ViewMode</a>&nbsp;m )
</h3><p>Sets the file dialog's view mode to <em>m</em>.
See the <a href="ntqfiledialog.html#viewMode-prop">"viewMode"</a> property for details.
<h3 class=fn>bool <a name="showHiddenFiles"></a>TQFileDialog::showHiddenFiles () const
</h3><p>Returns TRUE if hidden files are shown in the file dialog; otherwise returns FALSE.
See the <a href="ntqfiledialog.html#showHiddenFiles-prop">"showHiddenFiles"</a> property for details.
<h3 class=fn><a href="ntqurl.html">TQUrl</a> <a name="url"></a>TQFileDialog::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="ntqdialog.html#x2129">network/networkprotocol/view.cpp</a>.
<h3 class=fn><a href="ntqfiledialog.html#ViewMode-enum">ViewMode</a> <a name="viewMode"></a>TQFileDialog::viewMode () const
</h3><p>Returns the file dialog's view mode.
See the <a href="ntqfiledialog.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="ntqstring.html">TQString</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="ntqfiledialog.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="ntqfiledialog.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="ntqstring.html">TQString</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="ntqstring.html#isEmpty">TQString::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="ntqstringlist.html">TQStringList</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="ntqstringlist.html">TQStringList</a> list = myFileDialog.selectedFiles();
TQStringList::Iterator it = list.<a href="tqvaluelist.html#begin">begin</a>();
while( it != list.<a href="tqvaluelist.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="tqvaluelist.html#empty">TQValueList::empty</a>().
<p>Get this property's value with <a href="#selectedFiles">selectedFiles</a>().
<h3 class=fn><a href="ntqstring.html">TQString</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="ntqfiledialog.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">TQFileDialog::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">TQt toolkit</a>.
Copyright &copy; 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 &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>