Äîêóìåíò âçÿò èç êýøà ïîèñêîâîé ìàøèíû. Àäðåñ
îðèãèíàëüíîãî äîêóìåíòà
: http://rtm-cs.sinp.msu.ru/manual/qt/qfiledialog.html
Äàòà èçìåíåíèÿ: Sun Jul 12 02:58:59 1998 Äàòà èíäåêñèðîâàíèÿ: Mon Oct 1 20:32:52 2012 Êîäèðîâêà: |
The QFileDialog provides a dialog widget for inputting file names. More...
#include <qfiledialog.h>
Inherits QDialog.
Example:
QString fileName = QFileDialog::getOpenFileName(); if ( !fileName.isNull() ) { // got a file name ... }
There are two ready-made convenience functions, getOpenFileName() and getSaveFileName(), which may be used like this:
QString s( QFileDialog::getOpenFileName() ); if ( s.isNull() ) return; open( s ); // open() being your function to read the file
See also: QPrintDialog.
Examples: movies/main.cpp
Constructs a file dialog with a parent, name and modal flag.
The dialog becomes modal if modal is TRUE, otherwise modeless.
Constructs a file dialog with a parent, name and modal flag.
The dialog becomes modal if modal is TRUE, otherwise modeless.
Destroys the file dialog.
[protected]
Adds 1-3 widgets to the bottom of the file dialog. l is the (optional) label, which is put beneath the "file name" and "file type" labels, w is a (optional) widget, which is put beneath the file type combo box, and b is the (you guessed it - optional) button, which is put beneath the cancel button.
If you don't want to add something in one of the columns, pass 0.
It is not currently possible to add more than one row.
Returns the active directory in the file dialog.
See also: setDir().
[signal]
This signal is emitted when the user has selected a new directory.
Returns the active directory path string in the file dialog.
[virtual]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QObject.
[signal]
This signal is emitted when the user highlights a file.
[signal]
This signal is emitted when the user selects a file.
[static]
Ask the user for the name of an existing directory, starting at dir. Returns the name of the directory the user selected.
If dir is null, getExistingDirectory() starts wherever the previous file dialog left off.
[static]
Opens a modal file dialog and returns the name of the file to be opened.
If startWith is the name of a directory, the dialog starts off in that directory. If startWith is the name of an existing file, the dialogs starts in that directory, and with startWith selected.
Only files matching filter are selectable. If filter is 0, all files are selectable.
If widget and/or name is provided, the dialog will be centered over widget and named name.
getOpenFileName() returns a null string if the user cancelled the dialog.
This static function is less capable than the full QFileDialog object, but is convenient and easy to use.
Example:
// start at the current working directory and with *.cpp as filter QString f = QFileDialog::getOpenFileName( 0, "*.cpp", this ); if ( !f.isEmpty() ) { // the user selected a valid existing file } else { // the user cancelled the dialog }
getSaveFileName() is another convenience function, equal to this one except that it allows the user to specify the name of a nonexistent file name.
See also: getSaveFileName().
[static]
Opens a modal file dialog and returns the name of the file to be saved.
If startWith is the name of a directory, the dialog starts off in that directory. If startWith is the name of an existing file, the dialogs starts in that directory, and with startWith selected.
Only files matching filter are selectable. If filter is 0, all files are selectable.
If widget and/or name is provided, the dialog will be centered over widget and named name.
Returns a null string if the user cancelled the dialog.
This static function is less capable than the full QFileDialog object, but is convenient and easy to use.
Example:
// start at the current working directory and with *.cpp as filter QString f = QFileDialog::getSaveFileName( 0, "*.cpp", this ); if ( !f.isEmpty() ) { // the user gave a file name } else { // the user cancelled the dialog }
getOpenFileName() is another convenience function, equal to this one except that it does not allow the user to specify the name of a nonexistent file name.
See also: getOpenFileName().
[static]
Returns the icon provider currently in use. By default there is no icon provider and this function returns 0.
See also: setIconProvider() and QFileIconProvider.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
Returns the file mode of this dialog.
See also: setMode().
Re-reads the active directory in the file dialog.
It is seldom necessary to call this function. It is provided in case the directory contents change and you want to refresh the directory list box.
[virtual protected]
Handles resize events for the file dialog.
Reimplemented from QWidget.
Returns the selected file name.
If a file name was selected, the returned string contains the absolute path name. The returned string is a null string if no file name was selected.
See also: QString::isNull().
Sets a directory path for the file dialog.
See also: dir().
[slot]
Sets a directory path string for the file dialog.
See also: dir().
[slot]
Sets the filter spec in use to newFilter.
If newFilter matches the regular expression ([a-zA-Z0-9\.\*\?]*)$ (ie. it ends with a normal wildcard expression enclosed in parentheses), only the parenthesized is used. This means that these two calls are equivalent:
fd->setFilter( "All perl files (*.pl)" ); fd->setFilter( "*.pl" )
[slot]
Sets this file dialog to offer types in the File Type combo box. types must be a null-terminated list of strings; each string must be in the format described in the documentation for setFilter().
See also: setFilter().
[slot]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
[static]
Sets all file dialogs to use provider to select icons to draw for each file. By default there is no icon provider, and QFileDialog simply draws a "folder" icon next to each directory and nothing next to the files.
See also: QFileIconProvider and iconProvider().
Sets this file dialog to newMode, which can be one of Directory
(directories are accepted), ExistingFile
(existing
files are accepted) or AnyFile
(any valid file name is accepted).
See also: mode().
Sets the default selection to filename. If filename is absolute, setDir() is also called.
Search the documentation, FAQ, qt-interest archive and more (uses
www.troll.no):
This file is part of the Qt toolkit, copyright © 1995-98 Troll Tech, all rights reserved.
It was generated from the following files:
Copyright © 1998 Troll Tech | Trademarks | Qt version 1.40
|