Qfiledialog getopenfilename что возвращает
QFileDialog
Диалог выбора файлов и дирректорий
Класс QFileDialog предоставляет диалоговое окно позволяющее пользователям выбирать файлы или директории.
Класс QFileDialog позволяет пользователю перемещаться по иерархическим уровням файловой системы для выбора одного или нескольких файлов (директорий).
Самым простым способом создать диалоговое окно QFileDialog является использование статических функций.
В приведенном примере модальный QFileDialog создается с помощью статической функции. Изначально диалоговое окно отображает содержимое указанной директории «C:/Users/Alexey» и отображает файлы соответствующие установленному фильтру (*.png *.jpg *.bmp).
Если требуется установить несколько фильтров, то каждый фильтр разделяется двойным символом точки с запятой «;«, например:
QFileDialog можно создать без использования статических функций. Для того, чтобы указать что должен выбрать пользователь в диалоговом окне, следует воспользоваться методом setFileMode():
Список режимов выбора файл:
Константа | Значение | Описание |
QFileDialog::AnyFile | 0 | Имя файла независимо от того существует файл или нет. |
QFileDialog::ExistingFile | 1 | Имя одного существующего файла. |
QFileDialog::Directory | 2 | Имя директории. Отображаются и файлы и директории. Однако, нативное окно Windows не поддерживает отображение файлов при выборе директории. |
QFileDialog::ExistingFiles | 3 | Имена нескольких существующих файлов. |
QFileDialog::DirectoryOnly | 4 | Использует для отображения режим Directory и включенную опцию ShowDirsOnly. |
Методы
void | getExistingDirectory ( QWidget parent = 0, string caption = NULL, string dir = NULL, Options options = ShowDirsOnly ) |
string | getOpenFileName ( QWidget $parent = 0, string $caption = NULL, string $dir = NULL, string $filter = NULL, Options $options = NULL ) |
void | getSaveFileName ( QWidget parent = 0, string caption = NULL, string dir = NULL, string filter = NULL, Options options = NULL ) |
void | setFileMode ( FileMode mode ) |
void | setNameFilter ( string filter ) |
void | setViewMode ( ViewMode mode ) |
Описание методов
void QFileDialog:: getExistingDirectory ( QWidget parent = 0, string caption = NULL, string dir = NULL, Options options = ShowDirsOnly )
string QFileDialog:: getOpenFileName ( QWidget $parent = 0, string $caption = NULL, string $dir = NULL, string $filter = NULL, Options $options = NULL )
Открывает окно диалога выбора файла по установленному фильтру
void QFileDialog:: getSaveFileName ( QWidget parent = 0, string caption = NULL, string dir = NULL, string filter = NULL, Options options = NULL )
void QFileDialog:: setFileMode ( FileMode mode )
void QFileDialog:: setNameFilter ( string filter )
void QFileDialog:: setViewMode ( ViewMode mode )
Qfiledialog getopenfilename что возвращает
На этом шаге рассмотрим стандартное диалоговое окно выбора файлов.
Использование стандартных окон значительно ускоряет разработку тех приложений, в которых необходимо использовать диалоговые окна выбора файлов, шрифта, цвета и т. д. Вместо того чтобы тратить время на разработку своих собственных классов, можно воспользоваться готовыми классами библиотеки Qt. К достоинствам стандартных диалоговых окон можно отнести и целостность пользовательского интерфейса, т. к. вид окон во всех приложениях, их использующих, будет один и тот же.
Диалоговое окно выбора файлов предназначено для выбора одного или нескольких файлов, а также файлов, находящихся на удаленном компьютере, и поддерживает возможность переименования файлов и создания каталогов.
Класс QFileDialog предоставляет реализацию диалогового окна выбора файлов (рис. 1) и отвечает за создание и работоспособность сразу трех диалоговых окон. Одно из них позволяет осуществлять выбор файла для откры-тия, второе предназначено для выбора пути и имени файла для его сохранения, а третье — для выбора каталога.
Рис.1. Диалоговое окно выбора файлов
Класс QFileDialog унаследован от класса QDialog. Его определение находится в файле QFileDialog.
Этот класс предоставляет следующие статические методы:
Первым параметром этих методов является указатель на объект-предок, вторым передается текст заголовка окна, третьим — строка, представляющая собой рабочий каталог.
Вызов метода getOpenFileName() запустит диалоговое окно открытия файла (см. рис. 1). Четвертый параметр, передаваемый в этот метод, представляет собой фильтр (или маску), задающий расширение файлов. Например:
Покажем, как можно использовать статический метод getSaveFileName(), предназначенный для диалогового окна записи файла.
Файлы приложения можно взять здесь.
При помощи метода getExistingDirectory() можно предоставить пользователю возможность выбора каталога (рис. 2). Например:
Рис.2. Диалоговое окно выбора папки
Файлы приложения можно взять здесь.
На следующем шаге рассмотрим cтандартное диалоговое окно настройки принтера.
Оглавление
The QFileDialog class provides a dialog that allow users to select files or directories. Далее.
Открытые типы
Свойства
Открытые функции
QFileDialog ( QWidget * parent, Qt::WindowFlags flags ) | |
QFileDialog ( QWidget * parent = 0, const QString & caption = QString(), const QString & directory = QString(), const QString & filter = QString() ) | |
QFileDialog () | |
AcceptMode | acceptMode () const |
bool | confirmOverwrite () const |
QString | defaultSuffix () const |
QDir | directory () const |
FileMode | fileMode () const |
QDir::Filters | filter () const |
QStringList | history () const |
QFileIconProvider * | iconProvider () const |
bool | isNameFilterDetailsVisible () const |
bool | isReadOnly () const |
QAbstractItemDelegate * | itemDelegate () const |
QString | labelText ( DialogLabel label ) const |
QStringList | nameFilters () const |
void | open ( QObject * receiver, const char * member ) |
Параметры | options () const |
QAbstractProxyModel * | proxyModel () const |
bool | resolveSymlinks () const |
bool | restoreState ( const QByteArray & state ) |
QByteArray | saveState () const |
void | selectFile ( const QString & filename ) |
void | selectNameFilter ( const QString & filter ) |
QStringList | selectedFiles () const |
QString | selectedNameFilter () const |
void | setAcceptMode ( AcceptMode mode ) |
void | setConfirmOverwrite ( bool enabled ) |
void | setDefaultSuffix ( const QString & suffix ) |
void | setDirectory ( const QString & directory ) |
void | setDirectory ( const QDir & directory ) |
void | setFileMode ( FileMode mode ) |
void | setFilter ( QDir::Filters filters ) |
void | setHistory ( const QStringList & paths ) |
void | setIconProvider ( QFileIconProvider * provider ) |
void | setItemDelegate ( QAbstractItemDelegate * delegate ) |
void | setLabelText ( DialogLabel label, const QString & text ) |
void | setNameFilter ( const QString & filter ) |
void | setNameFilterDetailsVisible ( bool enabled ) |
void | setNameFilters ( const QStringList & filters ) |
void | setOption ( Option option, bool on = true ) |
void | setOptions ( Options options ) |
void | setProxyModel ( QAbstractProxyModel * proxyModel ) |
void | setReadOnly ( bool enabled ) |
void | setResolveSymlinks ( bool enabled ) |
void | setSidebarUrls ( const QList & urls ) |
void | setViewMode ( ViewMode mode ) |
QList | sidebarUrls () const |
bool | testOption ( Option option ) const |
ViewMode | viewMode () const |
Переопределённые открытые функции
Сигналы
Статические открытые члены
Переопределённые защищённые функции
Дополнительные унаследованные члены
Подробное описание
The QFileDialog class provides a dialog that allow users to select files or directories.
The QFileDialog class enables a user to traverse the file system in order to select one or many files or a directory.
The easiest way to create a QFileDialog is to use the static functions. On Windows, Mac OS X, KDE and GNOME, these static functions will call the native file dialog when possible.
In the above example, a modal QFileDialog is created using a static function. The dialog initially displays the contents of the «/home/jana» directory, and displays files matching the patterns given in the string «Image Files (*.png *.jpg *.bmp)». The parent of the file dialog is set to this, and the window title is set to «Open Image».
If you want to use multiple filters, separate each one with two semicolons. Например:
You can create your own QFileDialog without using the static functions. By calling setFileMode(), you can specify what the user must select in the dialog:
In the above example, the mode of the file dialog is set to AnyFile, meaning that the user can select any file, or even specify a file that doesn’t exist. This mode is useful for creating a «Save As» file dialog. Use ExistingFile if the user must select an existing file, or Directory if only a directory may be selected. See the QFileDialog::FileMode enum for the complete list of modes.
The fileMode property contains the mode of operation for the dialog; this indicates what types of objects the user is expected to select. Use setNameFilter() to set the dialog’s file filter. Например:
In the above example, the filter is set to "Images (*.png *.xpm *.jpg)", this means that only files with the extension png, xpm, or jpg will be shown in the QFileDialog. You can apply several filters by using setNameFilters(). Use selectNameFilter() to select one of the filters you’ve given as the file dialog’s default filter.
The file dialog has two view modes: List and Detail. List presents the contents of the current directory as a list of file and directory names. Detail also displays a list of file and directory names, but provides additional information alongside each name, such as the file size and modification date. Set the mode with setViewMode():
The last important function you will need to use when creating your own file dialog is selectedFiles().
In the above example, a modal file dialog is created and shown. If the user clicked OK, the file they selected is put in fileName.
The dialog’s working directory can be set with setDirectory(). Each file in the current directory can be selected using the selectFile() function.
The Standard Dialogs example shows how to use QFileDialog as well as other built-in Qt dialogs.
Описание типов-членов
enum QFileDialog:: AcceptMode
Константа | Значение |
---|---|
QFileDialog::AcceptOpen | 0 |
QFileDialog::AcceptSave | 1 |
enum QFileDialog:: DialogLabel
Константа | Значение |
---|---|
QFileDialog::LookIn | 0 |
QFileDialog::FileName | 1 |
QFileDialog::FileType | 2 |
QFileDialog::Accept | 3 |
QFileDialog::Reject | 4 |
enum QFileDialog:: FileMode
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.
Константа | Значение | Описание |
---|---|---|
QFileDialog::AnyFile | 0 | The name of a file, whether it exists or not. |
QFileDialog::ExistingFile | 1 | The name of a single existing file. |
QFileDialog::Directory | 2 | The name of a directory. Both files and directories are displayed. |
QFileDialog::ExistingFiles | 3 | The names of zero or more existing files. |
This value is obsolete since Qt 4.5:
Константа | Значение | Описание |
---|---|---|
QFileDialog::DirectoryOnly | 4 | Use Directory and setOption(ShowDirsOnly, true) instead. |
typedef QFileDialog:: Mode
enum QFileDialog:: Option
flags QFileDialog:: Options
Константа | Значение | Описание |
---|---|---|
QFileDialog::ShowDirsOnly | 0x00000001 | Only show directories in the file dialog. By default both files and directories are shown. (Valid only in the Directory file mode.) |
QFileDialog::DontResolveSymlinks | 0x00000002 | Don’t resolve symlinks in the file dialog. By default symlinks are resolved. |
QFileDialog::DontConfirmOverwrite | 0x00000004 | Don’t ask for confirmation if an existing file is selected. By default confirmation is requested. |
QFileDialog::DontUseNativeDialog | 0x00000010 | Don’t use the native file dialog. By default, the native file dialog is used unless you use a subclass of QFileDialog that contains the Q_OBJECT macro. |
QFileDialog::ReadOnly | 0x00000020 | Indicates that the model is readonly. |
QFileDialog::HideNameFilterDetails | 0x00000040 | Indicates if the file name filter details are hidden or not. |
QFileDialog::DontUseSheet | 0x00000008 | In previous versions of Qt, the static functions would create a sheet by default if the static function was given a parent. This is no longer supported and does nothing in Qt 4.5, The static functions will always be an application modal dialog. If you want to use sheets, use QFileDialog::open() instead. |
enum QFileDialog:: ViewMode
This enum describes the view mode of the file dialog; i.e. what information about each file will be displayed.
Константа | Значение | Описание |
---|---|---|
QFileDialog::Detail | 0 | Displays an icon, a name, and details for each item in the directory. |
QFileDialog::List | 1 | Displays only an icon and a name for each item in the directory. |
Описание свойств
acceptMode : AcceptMode
This property holds the accept mode of the dialog.
The action mode defines whether the dialog is for opening or saving files.
By default, this property is set to AcceptOpen.
AcceptMode | acceptMode () const |
void | setAcceptMode ( AcceptMode mode ) |
defaultSuffix : QString
This property holds suffix added to the filename if no other suffix was specified.
This property specifies a string that will be added to the filename if it has no suffix already. The suffix is typically used to indicate the file type (e.g. «txt» indicates a text file).
QString | defaultSuffix () const |
void | setDefaultSuffix ( const QString & suffix ) |
fileMode : FileMode
This property holds the file mode of the dialog.
The file mode defines the number and type of items that the user is expected to select in the dialog.
By default, this property is set to AnyFile.
This function will set the labels for the FileName and Accept DialogLabels. It is possible to set custom text after the call to setFileMode().
FileMode | fileMode () const |
void | setFileMode ( FileMode mode ) |
options : Options
Это свойство содержит различные опции, которые влияют на внешний вид и поведение диалога.
По умолчанию все опции отключены.
Опции должны быть установлены до показа диалога. Их установка пока диалог видим не гарантирует немедленного эффекта на диалоге (зависит от опции и платформы).
Это свойство было введено в Qt 4.5.
Параметры | options () const |
void | setOptions ( Options options ) |
viewMode : ViewMode
This property holds the way files and directories are displayed in the dialog.
By default, the Detail mode is used to display information about files and directories.
ViewMode | viewMode () const |
void | setViewMode ( ViewMode mode ) |
Описание функций-членов
QFileDialog:: QFileDialog ( QWidget * parent, Qt::WindowFlags flags )
Constructs a file dialog with the given parent and widget flags.
QFileDialog:: QFileDialog ( QWidget * parent = 0, const QString & caption = QString(), const QString & directory = QString(), const QString & filter = QString() )
Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory. The contents of the directory are filtered before being shown in the dialog, using a semicolon-separated list of filters specified by filter.
QFileDialog::
Destroys the file dialog.
void QFileDialog:: accept () [virtual protected]
void QFileDialog:: changeEvent ( QEvent * e ) [virtual protected]
void QFileDialog:: currentChanged ( const QString & path ) [signal]
When the current file changes, this signal is emitted with the new file name as the path parameter.
QDir QFileDialog:: directory () const
Returns the directory currently being displayed in the dialog.
void QFileDialog:: directoryEntered ( const QString & directory ) [signal]
This signal is emitted when the user enters a directory.
Эта функция была введена в Qt 4.3.
void QFileDialog:: done ( int result ) [virtual protected]
void QFileDialog:: fileSelected ( const QString & file ) [signal]
When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empty) selected file.
void QFileDialog:: filesSelected ( const QStringList & selected ) [signal]
When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empty) list of selected files.
QDir::Filters QFileDialog:: filter () const
Returns the filter that is used when displaying files.
Эта функция была введена в Qt 4.4.
void QFileDialog:: filterSelected ( const QString & filter ) [signal]
This signal is emitted when the user selects a filter.
Эта функция была введена в Qt 4.3.
QString QFileDialog:: getExistingDirectory ( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), Options options = ShowDirsOnly ) [static]
This is a convenience static function that will return an existing directory selected by the user.
This function creates a modal file dialog with the given parent widget. If parent is not 0, the dialog will be shown centered over the parent widget.
The dialog’s working directory is set to dir, and the caption is set to caption. Either of these may be an empty string in which case the current directory and a default caption will be used respectively.
The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass. To ensure a native file dialog, ShowDirsOnly must be set.
On Windows, Mac OS X and Symbian^3, this static function will use the native file dialog and not a QFileDialog. On Windows CE, if the device has no native file dialog, a QFileDialog will be used.
On 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 options includes DontResolveSymlinks, the file dialog will treat symlinks as regular directories.
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 below the parent’s title bar.
On Symbian^3 the options parameter is only used to define if the native file dialog is used.
Предупреждение: Не удаляйте parent во время выполнения диалога. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors.
QString QFileDialog:: getOpenFileName ( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), const QString & filter = QString(), QString * selectedFilter = 0, Options options = 0 ) [static]
This is a convenience static function that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.
The function creates a modal file dialog with the given parent widget. If parent is not 0, the dialog will be shown centered over the parent widget.
The file dialog’s working directory will be set to dir. If dir includes a file name, the file will be selected. Only files that match the given filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. If you want multiple filters, separate them with ‘;;’, for example:
The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.
The dialog’s caption is set to caption. If caption is not specified then a default caption will be used.
On Windows, Mac OS X and Symbian^3, this static function will use the native file dialog and not a QFileDialog.
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 below the parent’s title bar.
On 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 options includes DontResolveSymlinks, the file dialog will treat symlinks as regular directories.
On Symbian^3 the parameter selectedFilter has no meaning and the options parameter is only used to define if the native file dialog is used.
Предупреждение: Не удаляйте parent во время выполнения диалога. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors.
QStringList QFileDialog:: getOpenFileNames ( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), const QString & filter = QString(), QString * selectedFilter = 0, Options options = 0 ) [static]
This is a convenience static function that will return one or more existing files selected by the user.
This function creates a modal file dialog with the given parent widget. If parent is not 0, the dialog will be shown centered over the parent widget.
The file dialog’s working directory will be set to dir. If dir includes a file name, the file will be selected. The filter is set to filter so that only those files which match the filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter and filter may be empty strings. If you need multiple filters, separate them with ‘;;’, for instance:
The dialog’s caption is set to caption. If caption is not specified then a default caption will be used.
On Windows, Mac OS X and Symbian^3, this static function will use the native file dialog and not a QFileDialog.
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 below the parent’s title bar.
On 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. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.
Note: If you want to iterate over the list of files, you should iterate over a copy. Например:
On Symbian^3 the parameter selectedFilter has no meaning and the options parameter is only used to define if the native file dialog is used. On Symbian^3, this function can only return a single filename.
Предупреждение: Не удаляйте parent во время выполнения диалога. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors.
QString QFileDialog:: getSaveFileName ( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), const QString & filter = QString(), QString * selectedFilter = 0, Options options = 0 ) [static]
This is a convenience static function that will return a file name selected by the user. Файл не должен существовать.
It creates a modal file dialog with the given parent widget. If parent is not 0, the dialog will be shown centered over the parent widget.
The file dialog’s working directory will be set to dir. If dir includes a file name, the file will be selected. Only files that match the filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. Multiple filters are separated with ‘;;’. For instance:
The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.
The default filter can be chosen by setting selectedFilter to the desired value.
The dialog’s caption is set to caption. If caption is not specified, a default caption will be used.
On Windows, Mac OS X and Symbian^3, this static function will use the native file dialog and not a QFileDialog.
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 below the parent’s title bar. On Mac OS X, with its native file dialog, the filter argument is ignored.
On 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 options includes DontResolveSymlinks the file dialog will treat symlinks as regular directories.
On Symbian^3 the parameters filter and selectedFilter have no meaning. The options parameter is only used to define if the native file dialog is used.
Предупреждение: Не удаляйте parent во время выполнения диалога. If you want to do this, you should create the dialog yourself using one of the QFileDialog constructors.
QStringList QFileDialog:: history () const
Returns the browsing history of the filedialog as a list of paths.
QFileIconProvider * QFileDialog:: iconProvider () const
Returns the icon provider used by the filedialog.
QAbstractItemDelegate * QFileDialog:: itemDelegate () const
Returns the item delegate used to render the items in the views in the filedialog.
QString QFileDialog:: labelText ( DialogLabel label ) const
Returns the text shown in the filedialog in the specified label.
QStringList QFileDialog:: nameFilters () const
Returns the file type filters that are in operation on this file dialog.
Эта функция была введена в Qt 4.4.
void QFileDialog:: open ( QObject * receiver, const char * member )
Это перегруженная функция.
This function connects one of its signals to the slot specified by receiver and member. The specific signal depends is filesSelected() if fileMode is ExistingFiles and fileSelected() if fileMode is anything else.
Сигнал будет отсоединен от слота когда диалог закрывается.
Эта функция была введена в Qt 4.5.
QAbstractProxyModel * QFileDialog:: proxyModel () const
Returns the proxy model used by the file dialog. By default no proxy is set.
bool QFileDialog:: restoreState ( const QByteArray & state )
Restores the dialogs’s layout, history and current directory to the state specified.
Typically this is used in conjunction with QSettings to restore the size from a past session.
Returns false if there are errors
Эта функция была введена в Qt 4.3.
QByteArray QFileDialog:: saveState () const
Saves the state of the dialog’s layout, history and current directory.
Typically this is used in conjunction with QSettings to remember the size for a future session. A version number is stored as part of the data.
Эта функция была введена в Qt 4.3.
void QFileDialog:: selectFile ( const QString & filename )
Selects the given filename in the file dialog.
void QFileDialog:: selectNameFilter ( const QString & filter )
Sets the current file type filter. Multiple filters can be passed in filter by separating them with semicolons or spaces.
Эта функция была введена в Qt 4.4.
QStringList QFileDialog:: selectedFiles () const
Returns a list of strings containing the absolute paths of the selected files in the dialog. If no files are selected, or the mode is not ExistingFiles or ExistingFile, selectedFiles() contains the current path in the viewport.
QString QFileDialog:: selectedNameFilter () const
Returns the filter that the user selected in the file dialog.
Эта функция была введена в Qt 4.4.
void QFileDialog:: setDirectory ( const QString & directory )
Sets the file dialog’s current directory.
void QFileDialog:: setDirectory ( const QDir & directory )
Это перегруженная функция.
void QFileDialog:: setFilter ( QDir::Filters filters )
Sets the filter used by the model to filters. The filter is used to specify the kind of files that should be shown.
Эта функция была введена в Qt 4.4.
void QFileDialog:: setHistory ( const QStringList & paths )
Sets the browsing history of the filedialog to contain the given paths.
void QFileDialog:: setIconProvider ( QFileIconProvider * provider )
Sets the icon provider used by the filedialog to the specified provider.
void QFileDialog:: setItemDelegate ( QAbstractItemDelegate * delegate )
Sets the item delegate used to render items in the views in the file dialog to the given delegate.
Warning: You should not share the same instance of a delegate between views. Doing so can cause incorrect or unintuitive editing behavior since each view connected to a given delegate may receive the closeEditor() signal, and attempt to access, modify or close an editor that has already been closed.
Note that the model used is QFileSystemModel. It has custom item data roles, which is described by the Roles enum. You can use a QFileIconProvider if you only want custom icons.
void QFileDialog:: setLabelText ( DialogLabel label, const QString & text )
Sets the text shown in the filedialog in the specified label.
void QFileDialog:: setNameFilter ( const QString & filter )
Sets the filter used in the file dialog to the given filter.
If filter contains a pair of parentheses containing one or more of anything*something, separated by spaces, then only the text contained in the parentheses is used as the filter. This means that these calls are all equivalent:
Эта функция была введена в Qt 4.4.
void QFileDialog:: setNameFilters ( const QStringList & filters )
Sets the filters used in the file dialog.
Эта функция была введена в Qt 4.4.
void QFileDialog:: setOption ( Option option, bool on = true )
Устанавливает заданную опцию option включённой если on равно true; в противном случае очищает заданную опцию option.
Эта функция была введена в Qt 4.5.
void QFileDialog:: setProxyModel ( QAbstractProxyModel * proxyModel )
Sets the model for the views to the given proxyModel. This is useful if you want to modify the underlying model; for example, to add columns, filter data or add drives.
Any existing proxy model will be removed, but not deleted. The file dialog will take ownership of the proxyModel.
Эта функция была введена в Qt 4.3.
void QFileDialog:: setSidebarUrls ( const QList QUrl > & urls )
Sets the urls that are located in the sidebar.
The file dialog will then look like this:
Эта функция была введена в Qt 4.3.
void QFileDialog:: setVisible ( bool visible ) [virtual]
QList QUrl > QFileDialog:: sidebarUrls () const
Returns a list of urls that are currently in the sidebar
Эта функция была введена в Qt 4.3.
bool QFileDialog:: testOption ( Option option ) const
Возвращает true если заданная опция option включена; в противном случае возвращается false.
Эта функция была введена в Qt 4.5.
Все остальные торговые марки являются собственностью их владельцев. Политика конфиденциальности
Лицензиаты, имеющие действительные коммерческие лицензии Qt, могут использовать этот документ в соответствии с соглашениями коммерческой лицензии Qt, поставляемой с программным обеспечением, либо, альтернативно, в соответствии с условиями, содержащимися в письменном соглашении между вами и Nokia.
Кроме того, этот документ может быть использован в соответствии с условиями GNU Free Documentation License version 1.3, опубликованной фондом Free Software Foundation.