<tdalign="right"valign="center"><imgsrc="logo32.png"align="right"width="64"height="32"border="0"></td></tr></table><h1align=center>TQFileDialog Class Reference</h1>
<p>The TQFileDialog class provides dialogs that allow users to select files or directories.
<liclass=fn>bool <ahref="#contentsPreview-prop"><b>contentsPreview</b></a> - whether the file dialog can provide a contents preview of the currently selected file</li>
<liclass=fn>TQString <ahref="#dirPath-prop"><b>dirPath</b></a> - the file dialog's working directory <em>(read only)</em></li>
<liclass=fn>bool <ahref="#infoPreview-prop"><b>infoPreview</b></a> - whether the file dialog can provide preview information about the currently selected file</li>
<liclass=fn>Mode <ahref="#mode-prop"><b>mode</b></a> - the file dialog's mode</li>
<liclass=fn>PreviewMode <ahref="#previewMode-prop"><b>previewMode</b></a> - the preview mode for the file dialog</li>
<liclass=fn>TQString <ahref="#selectedFile-prop"><b>selectedFile</b></a> - the name of the selected file <em>(read only)</em></li>
<liclass=fn>TQStringList <ahref="#selectedFiles-prop"><b>selectedFiles</b></a> - the list of selected files <em>(read only)</em></li>
<liclass=fn>TQString <ahref="#selectedFilter-prop"><b>selectedFilter</b></a> - the filter which the user has selected in the file dialog <em>(read only)</em></li>
<liclass=fn>bool <ahref="#showHiddenFiles-prop"><b>showHiddenFiles</b></a> - whether hidden files are shown in the file dialog</li>
<liclass=fn>ViewMode <ahref="#viewMode-prop"><b>viewMode</b></a> - the file dialog's view mode</li>
<p> In the above example, the mode of the file dialog is set to <ahref="#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 <ahref="#Mode-enum">ExistingFile</a> if the user must select an
existing file or <ahref="#Mode-enum">Directory</a> if only a directory may be selected.
(See the <ahref="#Mode-enum">TQFileDialog::Mode</a> enum for the complete list of modes.)
<p> You can retrieve the dialog's mode with <ahref="#mode">mode</a>(). Use <ahref="#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 TQFileDialog. You can apply
several filters by using <ahref="#setFilters">setFilters</a>() and add additional filters with
<ahref="#addFilter">addFilter</a>(). Use <ahref="#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 <ahref="#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 <ahref="#setViewMode">setViewMode</a>().
<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 <ahref="#setPreviewMode">setPreviewMode</a>(), <ahref="#setContentsPreview">setContentsPreview</a>() and <ahref="#setInfoPreview">setInfoPreview</a>().
<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 <ahref="#addToolButton">addToolButton</a>(), <ahref="#addLeftWidget">addLeftWidget</a>(), and <ahref="#addRightWidget">addRightWidget</a>().
<p> This signal is emitted when the user selects a file.
<p><p>See also <ahref="#filesSelected">filesSelected</a>(), <ahref="#fileHighlighted">fileHighlighted</a>(), and <ahref="#selectedFile-prop">selectedFile</a>.
<p> This signal is emitted when the user selects one or more files in <em>ExistingFiles</em> mode.
<p><p>See also <ahref="#fileSelected">fileSelected</a>(), <ahref="#fileHighlighted">fileHighlighted</a>(), and <ahref="#selectedFiles-prop">selectedFiles</a>.
This is a convenience static function that will return an existing directory
selected by the user.
<p><pre>
<ahref="qstring.html">TQString</a> s = TQFileDialog::<ahref="#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 <ahref="qstring.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 <ahref="#getOpenFileName">getOpenFileName</a>(), <ahref="#getOpenFileNames">getOpenFileNames</a>(), and <ahref="#getSaveFileName">getSaveFileName</a>().
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>
<ahref="qstring.html">TQString</a> s = TQFileDialog::<ahref="#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 <ahref="qstring.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 <ahref="#getOpenFileNames">getOpenFileNames</a>(), <ahref="#getSaveFileName">getSaveFileName</a>(), and <ahref="#getExistingDirectory">getExistingDirectory</a>().
<p>Examples: <ahref="qaction-application-example.html#x1132">action/application.cpp</a>, <ahref="addressbook-example.html#x567">addressbook/mainwindow.cpp</a>, <ahref="simple-application-example.html#x1549">application/application.cpp</a>, <ahref="distributor-example.html#x2660">distributor/distributor.ui.h</a>, <ahref="ftpclient-example.html#x741">network/ftpclient/ftpmainwindow.ui.h</a>, <ahref="qwerty-example.html#x365">qwerty/qwerty.cpp</a>, and <ahref="showimg-example.html#x1318">showimg/showimg.cpp</a>.
<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 <ahref="qstring.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>
<ahref="qstringlist.html">TQStringList</a> list = files;
TQStringList::Iterator it = list.<ahref="qvaluelist.html#begin">begin</a>();
while( it != list.<ahref="qvaluelist.html#end">end</a>() ) {
myProcessing( *it );
++it;
}
</pre>
<p><p>See also <ahref="#getOpenFileName">getOpenFileName</a>(), <ahref="#getSaveFileName">getSaveFileName</a>(), and <ahref="#getExistingDirectory">getExistingDirectory</a>().
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>
<ahref="qstring.html">TQString</a> s = TQFileDialog::<ahref="#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 <ahref="qstring.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 <ahref="#getOpenFileName">getOpenFileName</a>(), <ahref="#getOpenFileNames">getOpenFileNames</a>(), and <ahref="#getExistingDirectory">getExistingDirectory</a>().
<p>Examples: <ahref="qaction-application-example.html#x1133">action/application.cpp</a>, <ahref="addressbook-example.html#x568">addressbook/mainwindow.cpp</a>, <ahref="simple-application-example.html#x1550">application/application.cpp</a>, <ahref="ftpclient-example.html#x742">network/ftpclient/ftpmainwindow.ui.h</a>, <ahref="qmag-example.html#x1775">qmag/qmag.cpp</a>, <ahref="qwerty-example.html#x366">qwerty/qwerty.cpp</a>, and <ahref="showimg-example.html#x1319">showimg/showimg.cpp</a>.
<p><p>See also <ahref="#contentsPreview-prop">contentsPreview</a>, <ahref="#setInfoPreview">setInfoPreview</a>(), and <ahref="#previewMode-prop">previewMode</a>.
<p><p>See also <ahref="#setContentsPreview">setContentsPreview</a>(), <ahref="#infoPreview-prop">infoPreview</a>, and <ahref="#previewMode-prop">previewMode</a>.
</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 <ahref="#filterSelected">filterSelected</a>(), <ahref="#selectedFilter-prop">selectedFilter</a>, <ahref="#selectedFiles-prop">selectedFiles</a>, and <ahref="#selectedFile-prop">selectedFile</a>.
<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 <ahref="#setContentsPreview">setContentsPreview</a>() and <ahref="#infoPreview-prop">infoPreview</a>.
<p>Set this property's value with <ahref="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>() and get this property's value with <ahref="#isContentsPreviewEnabled">isContentsPreviewEnabled</a>().
<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 <ahref="#setInfoPreviewEnabled">setInfoPreviewEnabled</a>() and get this property's value with <ahref="#isInfoPreviewEnabled">isInfoPreviewEnabled</a>().
<p><p>See also <ahref="#infoPreview-prop">infoPreview</a>, <ahref="#contentsPreview-prop">contentsPreview</a>, and <ahref="#viewMode-prop">viewMode</a>.
<p>Set this property's value with <ahref="#setPreviewMode">setPreviewMode</a>() and get this property's value with <ahref="#previewMode">previewMode</a>().
<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 <ahref="qstring.html#isEmpty">TQString::isEmpty</a>(), <ahref="#selectedFiles-prop">selectedFiles</a>, and <ahref="#selectedFilter-prop">selectedFilter</a>.
<p>Get this property's value with <ahref="#selectedFile">selectedFile</a>().
<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 <ahref="#selectedFile">selectedFile</a>() if the mode is
<ahref="#Mode-enum">ExistingFile</a>, <ahref="#Mode-enum">Directory</a> or <ahref="#Mode-enum">DirectoryOnly</a>.
<p> Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
<pre>
<ahref="qstringlist.html">TQStringList</a> list = myFileDialog.selectedFiles();
TQStringList::Iterator it = list.<ahref="qvaluelist.html#begin">begin</a>();
while( it != list.<ahref="qvaluelist.html#end">end</a>() ) {
myProcessing( *it );
++it;
}
</pre>
<p><p>See also <ahref="#selectedFile-prop">selectedFile</a>, <ahref="#selectedFilter-prop">selectedFilter</a>, and <ahref="qvaluelist.html#empty">TQValueList::empty</a>().
<p>Get this property's value with <ahref="#selectedFiles">selectedFiles</a>().
<p>This property holds the filter which the user has selected in the file dialog.
<p>Get this property's value with <ahref="#selectedFilter">selectedFilter</a>().
<p><p>See also <ahref="#filterSelected">filterSelected</a>(), <ahref="#selectedFiles-prop">selectedFiles</a>, and <ahref="#selectedFile-prop">selectedFile</a>.
<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 <ahref="#setShowHiddenFiles">setShowHiddenFiles</a>() and get this property's value with <ahref="#showHiddenFiles">showHiddenFiles</a>().