summaryrefslogtreecommitdiffstats
path: root/doc/html/qfiledialog.html
blob: 3eae5bea367d52a454b152ee58c259fa01480c95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
<!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&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QFileDialog Class Reference</h1>

<p>The QFileDialog class provides dialogs that allow users to select files or directories.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qfiledialog-h.html">qfiledialog.h</a>&gt;</tt>
<p>Inherits <a href="qdialog.html">QDialog</a>.
<p><a href="qfiledialog-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QFileDialog"><b>QFileDialog</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;dirName, const&nbsp;QString&nbsp;&amp;&nbsp;filter = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = FALSE )</li>
<li class=fn><a href="#QFileDialog-2"><b>QFileDialog</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = FALSE )</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&nbsp;QString&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;QString&nbsp;&amp;&nbsp;filename )</li>
<li class=fn>void <a href="#selectAll"><b>selectAll</b></a> ( bool&nbsp;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&nbsp;QDir&nbsp;&amp;&nbsp;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&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> ( QWidget&nbsp;*&nbsp;w, QFilePreview&nbsp;*&nbsp;preview )</li>
<li class=fn>void <a href="#setContentsPreview"><b>setContentsPreview</b></a> ( QWidget&nbsp;*&nbsp;w, QFilePreview&nbsp;*&nbsp;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&nbsp;QString&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;QString&nbsp;&amp;&nbsp;pathstr )</li>
<li class=fn>void <a href="#setUrl"><b>setUrl</b></a> ( const&nbsp;QUrlOperator&nbsp;&amp;&nbsp;url )</li>
<li class=fn>void <a href="#setFilter"><b>setFilter</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;newFilter )</li>
<li class=fn>void <a href="#setFilters"><b>setFilters</b></a> ( const&nbsp;QString&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 QStringList &amp; )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#fileHighlighted"><b>fileHighlighted</b></a> ( const QString &amp; )</li>
<li class=fn>void <a href="#fileSelected"><b>fileSelected</b></a> ( const QString &amp; )</li>
<li class=fn>void <a href="#filesSelected"><b>filesSelected</b></a> ( const QStringList &amp; )</li>
<li class=fn>void <a href="#dirEntered"><b>dirEntered</b></a> ( const QString &amp; )</li>
<li class=fn>void <a href="#filterSelected"><b>filterSelected</b></a> ( const QString &amp; )</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>QString <a href="#getOpenFileName"><b>getOpenFileName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;startWith = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;filter = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;QString&nbsp;&amp;&nbsp;caption = QString::null, QString&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )</li>
<li class=fn>QString <a href="#getSaveFileName"><b>getSaveFileName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;startWith = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;filter = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;QString&nbsp;&amp;&nbsp;caption = QString::null, QString&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )</li>
<li class=fn>QString <a href="#getExistingDirectory"><b>getExistingDirectory</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;dir = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;QString&nbsp;&amp;&nbsp;caption = QString::null, bool&nbsp;dirOnly = TRUE, bool&nbsp;resolveSymlinks = TRUE )</li>
<li class=fn>QStringList <a href="#getOpenFileNames"><b>getOpenFileNames</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;filter = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;dir = QString::null, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;QString&nbsp;&amp;&nbsp;caption = QString::null, QString&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )</li>
<li class=fn>void <a href="#setIconProvider"><b>setIconProvider</b></a> ( QFileIconProvider&nbsp;*&nbsp;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>&nbsp;- 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>&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>QString <a href="#selectedFile-prop"><b>selectedFile</b></a>&nbsp;- the name of the selected file &nbsp;<em>(read only)</em></li>
<li class=fn>QStringList <a href="#selectedFiles-prop"><b>selectedFiles</b></a>&nbsp;- the list of selected files &nbsp;<em>(read only)</em></li>
<li class=fn>QString <a href="#selectedFilter-prop"><b>selectedFilter</b></a>&nbsp;- the filter which the user has selected in the file dialog &nbsp;<em>(read only)</em></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> ( QLabel&nbsp;*&nbsp;l, QWidget&nbsp;*&nbsp;w, QPushButton&nbsp;*&nbsp;b )</li>
<li class=fn>void <a href="#addToolButton"><b>addToolButton</b></a> ( QButton&nbsp;*&nbsp;b, bool&nbsp;separator = FALSE )</li>
<li class=fn>void <a href="#addLeftWidget"><b>addLeftWidget</b></a> ( QWidget&nbsp;*&nbsp;w )</li>
<li class=fn>void <a href="#addRightWidget"><b>addRightWidget</b></a> ( QWidget&nbsp;*&nbsp;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-&gt;<a href="#setMode">setMode</a>( QFileDialog::<a href="#Mode-enum">AnyFile</a> );
  </pre>
 
<p> In the above example, the mode of the file dialog is set to <a href="#Mode-enum">AnyFile</a>, meaning that the user can select any file, or even specify a
file that doesn't exist. This mode is useful for creating a "File Save
As" file dialog. Use <a href="#Mode-enum">ExistingFile</a> if the user must select an
existing file or <a href="#Mode-enum">Directory</a> if only a directory 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-&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 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-&gt;setViewMode( QFileDialog::<a href="#ViewMode-enum">Detail</a> );
  </pre>
 
<p> The last important function you will need to use when creating your
own file dialog is <a href="#selectedFile">selectedFile</a>().
<p> <pre>
    <a href="qstring.html">QString</a> fileName;
    if ( fd-&gt;exec() == QDialog::<a href="qdialog.html#DialogCode-enum">Accepted</a> )
        fileName = fd-&gt;selectedFile();
  </pre>
 
<p> In the above example, a modal file dialog is created and shown. If
the user clicked OK, then the file they selected is put in <tt>fileName</tt>.
<p> If you are using the <a href="#Mode-enum">ExistingFiles</a> mode then you will need to use
<a href="#selectedFiles">selectedFiles</a>() which will return the selected files in a <a href="qstringlist.html">QStringList</a>.
<p> The dialog's working directory can be set with <a href="#setDir">setDir</a>(). The display
of hidden files is controlled with <a href="#setShowHiddenFiles">setShowHiddenFiles</a>(). The dialog
can be forced to re-read the directory with <a href="#rereadDir">rereadDir</a>() and re-sort
the directory with <a href="#resortDir">resortDir</a>(). All the files in the current directory
can be selected with <a href="#selectAll">selectAll</a>().
<p> <h3> Creating and using preview widgets
</h3>
<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> &amp;u )
        {
            <a href="qstring.html">QString</a> path = u.<a href="qurl.html#path">path</a>();
            <a href="qpixmap.html">QPixmap</a> pix( path );
            if ( pix.<a href="qpixmap.html#isNull">isNull</a>() )
                setText( "This is not a pixmap" );
            else
                setPixmap( pix );
        }
    };
  </pre>
 
<p> In the above snippet, we create a preview widget which inherits from
<a href="qlabel.html">QLabel</a> and <a href="qfilepreview.html">QFilePreview</a>. File preview widgets <em>must</em> inherit from
QFilePreview.
<p> Inside the class we reimplement <a href="qfilepreview.html#previewUrl">QFilePreview::previewUrl</a>(), this is
where we determine what happens when a file is selected. In the
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-&gt;<a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE );
    fd-&gt;<a href="#setContentsPreview">setContentsPreview</a>( p, p );
    fd-&gt;<a href="#setPreviewMode">setPreviewMode</a>( QFileDialog::<a href="#PreviewMode-enum">Contents</a> );
    fd-&gt;<a href="qdialog.html#show">show</a>();
  </pre>
 
<p> The first line creates an instance of our preview widget. We then
create our file dialog and call <a href="#setContentsPreviewEnabled">setContentsPreviewEnabled</a>( TRUE ),
this tell the file dialog to preview the contents of the currently
selected file. We then call <a href="#setContentsPreview">setContentsPreview</a>() -- note that we pass
the same preview widget twice. Finally, before showing the file
dialog, we call <a href="#setPreviewMode">setPreviewMode</a>() setting the mode to <em>Contents</em> which
will show the contents 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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;dirName, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filter = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, bool&nbsp;modal = FALSE )
</h3>
Constructs a file dialog 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>&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="~QFileDialog"></a>QFileDialog::~QFileDialog ()
</h3>
Destroys the file dialog.

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

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

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

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

<h3 class=fn>void <a name="addWidgets"></a>QFileDialog::addWidgets ( <a href="qlabel.html">QLabel</a>&nbsp;*&nbsp;l, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;w, <a href="qpushbutton.html">QPushButton</a>&nbsp;*&nbsp;b )<tt> [protected]</tt>
</h3>
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&nbsp;<a href="qdir.html">QDir</a>&nbsp;* <a name="dir"></a>QFileDialog::dir () const
</h3>
Returns the current directory shown in the file dialog.
<p> 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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [signal]</tt>
</h3>

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

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

<p> This signal is emitted when the user highlights a file, 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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [signal]</tt>
</h3>

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

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

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

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

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

<h3 class=fn><a href="qstring.html">QString</a> <a name="getExistingDirectory"></a>QFileDialog::getExistingDirectory ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;dir = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption = QString::null, bool&nbsp;dirOnly = TRUE, bool&nbsp;resolveSymlinks = TRUE )<tt> [static]</tt>
</h3>
This is a convenience static function that will return an existing directory
selected by the user.
<p> <pre>
    <a href="qstring.html">QString</a> s = QFileDialog::<a href="#getExistingDirectory">getExistingDirectory</a>(
                    "/home",
                    this,
                    "get existing directory",
                    "Choose a directory",
                    TRUE );
  </pre>
 
<p> This function creates a modal file dialog 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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;startWith = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filter = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption = QString::null, <a href="qstring.html">QString</a>&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )<tt> [static]</tt>
</h3>
This is a convenience static function that returns an existing file
selected by the user. If the user pressed Cancel, it returns a null
string.
<p> <pre>
    <a href="qstring.html">QString</a> s = QFileDialog::<a href="#getOpenFileName">getOpenFileName</a>(
                    "/home",
                    "Images (*.png *.xpm *.jpg)",
                    this,
                    "open file dialog",
                    "Choose a file 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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filter = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;dir = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption = QString::null, <a href="qstring.html">QString</a>&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )<tt> [static]</tt>
</h3>
This is a convenience static function that will return one or more
existing files 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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;startWith = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filter = QString::null, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;caption = QString::null, <a href="qstring.html">QString</a>&nbsp;*&nbsp;selectedFilter = 0, bool&nbsp;resolveSymlinks = TRUE )<tt> [static]</tt>
</h3>
This is a convenience static function that will return a file name
selected by the user. The file does not have to exist.
<p> It creates a modal file dialog 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>&nbsp;* <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&nbsp;b )
</h3>
If <em>b</em> is TRUE then all the files in the current directory are selected;
otherwise, they are deselected.

<h3 class=fn><a href="qstring.html">QString</a> <a name="selectedFile"></a>QFileDialog::selectedFile () const
</h3><p>Returns the name of the selected file.
See the <a href="qfiledialog.html#selectedFile-prop">"selectedFile"</a> property for details.
<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="selectedFiles"></a>QFileDialog::selectedFiles () const
</h3><p>Returns 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>&nbsp;*&nbsp;w, <a href="qfilepreview.html">QFilePreview</a>&nbsp;*&nbsp;preview )
</h3>
Sets the widget to be used for displaying the contents of the file
to the widget <em>w</em> and a preview of those contents to the
<a href="qfilepreview.html">QFilePreview</a> <em>preview</em>.
<p> Normally you would create a preview widget that derives from both <a href="qwidget.html">QWidget</a> and
QFilePreview, so you should pass the same widget twice. 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> &amp;u )
        {
            <a href="qstring.html">QString</a> path = u.<a href="qurl.html#path">path</a>();
            <a href="qpixmap.html">QPixmap</a> pix( path );
            if ( pix.<a href="qpixmap.html#isNull">isNull</a>() )
                setText( "This is not a pixmap" );
            else
                setPixmap( pix );
        }
    };

  //...

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

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

<p>Example: <a href="qdir-example.html#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&nbsp;<a href="qdir.html">QDir</a>&nbsp;&amp;&nbsp;dir )
</h3>
Sets the file dialog's working directory to <em>dir</em>.
<p>See also <a href="#dir">dir</a>().

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

<h3 class=fn>void <a name="setFilter"></a>QFileDialog::setFilter ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;newFilter )<tt> [slot]</tt>
</h3>
<p> Sets the filter used in the file dialog to <em>newFilter</em>.
<p> If <em>newFilter</em> contains a pair of parentheses containing one or more
of <em><b>anything*something</b></em> separated by spaces or by
semi-colons then only the text contained in the parentheses is used as
the filter. This means that these calls are all equivalent:
<p> <pre>
     fd-&gt;setFilter( "All C++ files (*.cpp *.cc *.C *.cxx *.c++)" );
     fd-&gt;setFilter( "*.cpp *.cc *.C *.cxx *.c++" );
     fd-&gt;setFilter( "All C++ files (*.cpp;*.cc;*.C;*.cxx;*.c++)" );
     fd-&gt;setFilter( "*.cpp;*.cc;*.C;*.cxx;*.c++" );
  </pre>
 
<p> <p>See also <a href="#setFilters">setFilters</a>().

<h3 class=fn>void <a name="setFilters"></a>QFileDialog::setFilters ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filters )<tt> [slot]</tt>
</h3>
Sets the filters used in the file dialog to <em>filters</em>. Each group
of filters must be separated by <tt>;;</tt> (<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-&gt;<a href="#setFilters">setFilters</a>( types );
    fd-&gt;<a href="qdialog.html#show">show</a>();
  </pre>
 
<p> 
<h3 class=fn>void <a name="setFilters-2"></a>QFileDialog::setFilters ( const&nbsp;char&nbsp;**&nbsp;types )<tt> [slot]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <em>types</em> must be a null-terminated list of strings.
<p> 
<h3 class=fn>void <a name="setFilters-3"></a>QFileDialog::setFilters ( const&nbsp;<a href="qstringlist.html">QStringList</a>&nbsp;&amp; )<tt> [slot]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> 
<h3 class=fn>void <a name="setIconProvider"></a>QFileDialog::setIconProvider ( <a href="qfileiconprovider.html">QFileIconProvider</a>&nbsp;*&nbsp;provider )<tt> [static]</tt>
</h3>
Sets the <a href="qfileiconprovider.html">QFileIconProvider</a> used 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>&nbsp;*&nbsp;w, <a href="qfilepreview.html">QFilePreview</a>&nbsp;*&nbsp;preview )
</h3>
Sets the widget to be used for displaying information about the file
to the widget <em>w</em> and a preview of that information to the
<a href="qfilepreview.html">QFilePreview</a> <em>preview</em>.
<p> Normally you would create a preview widget that derives from both <a href="qwidget.html">QWidget</a> and
QFilePreview, so you should pass the same widget twice. 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> &amp;u )
        {
            <a href="qstring.html">QString</a> path = u.<a href="qurl.html#path">path</a>();
            <a href="qpixmap.html">QPixmap</a> pix( path );
            if ( pix.<a href="qpixmap.html#isNull">isNull</a>() )
                setText( "This is not a pixmap" );
            else
                setText( "This is a pixmap" );
        }
    };

  //...

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

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

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

<p> 
<h3 class=fn>void <a name="setInfoPreviewEnabled"></a>QFileDialog::setInfoPreviewEnabled ( bool )
</h3><p>Sets whether the file dialog 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>&nbsp;m )
</h3><p>Sets the preview mode for the file dialog to <em>m</em>.
See the <a href="qfiledialog.html#previewMode-prop">"previewMode"</a> property for details.
<h3 class=fn>void <a name="setSelectedFilter"></a>QFileDialog::setSelectedFilter ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;mask )<tt> [virtual]</tt>
</h3>
Sets the current filter selected in the file dialog to the first
one that contains the text <em>mask</em>.

<h3 class=fn>void <a name="setSelectedFilter-2"></a>QFileDialog::setSelectedFilter ( int&nbsp;n )<tt> [virtual]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Sets the current filter selected in the file dialog to the
<em>n</em>-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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;filename )
</h3>
Sets the default selection to <em>filename</em>. If <em>filename</em> is
absolute, <a href="#setDir">setDir</a>() is also called to set the file dialog's working
directory to the filename's directory.
<p> 

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

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

<p>Example: <a href="qdialog.html#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 &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>Qt 3.3.8</div>
</table></div></address></body>
</html>