PythonQt.QtGui.QFileDialog · declarations 003
Back to PythonQt.QtGui.QFileDialog
setDefaultSuffix
setDefaultSuffix(suffix: str) -> None
X.setDefaultSuffix(suffix)
Upstream PySide2 reference signatures (binding differences may apply):
setDefaultSuffix(self, suffix: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setDefaultSuffix
setDirectory
setDirectory(directory: Any) -> None
X.setDirectory(directory)
Supplemental documentation: Qt 5 reference:
void QFileDialog::setDirectory(const QString \&directory)
Sets the file dialog's current directory.
Note: On iOS, if you set directory to
QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last(),
a native image picker dialog will be used for accessing the user's photo album. The
filename returned can be loaded using
QFile and related APIs. For this to be
enabled, the Info.plist assigned to
QMAKE_INFO_PLIST
in the project file must contain the key NSPhotoLibraryUsageDescription. See
Info.plist documentation from Apple for more information regarding this key. This
feature was added in Qt 5.5.
See also directory().
void QFileDialog::setDirectory(const QDir \&directory)
This is an overloaded function.
Upstream PySide2 reference signatures (binding differences may apply):
setDirectory(self, directory: PySide2.QtCore.QDir) -> None
setDirectory(self, directory: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setDirectory
setDirectoryUrl
setDirectoryUrl(directory: Any) -> None
X.setDirectoryUrl(directory)
Supplemental documentation: Qt 5 reference:
void QFileDialog::setDirectoryUrl(const QUrl \&directory)
Sets the file dialog's current directory url.
Note: The non-native QFileDialog supports only local files.
Note: On Windows, it is possible to pass URLs representing one of the virtual
folders, such as "Computer" or "Network". This is done by passing a
QUrl using the scheme clsid followed
by the CLSID value with the curly braces removed. For example the URL
clsid:374DE290-123F-4565-9164-39C4925E467B denotes the download location. For a
complete list of possible values, see the MSDN documentation on
KNOWNFOLDERID.
This feature was added in Qt 5.5.
This function was introduced in Qt 5.2.
See also directoryUrl() and QUuid.
Upstream PySide2 reference signatures (binding differences may apply):
setDirectoryUrl(self, directory: PySide2.QtCore.QUrl) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setDirectoryUrl
setFileMode
setFileMode(mode: Any) -> None
X.setFileMode(mode)
Upstream PySide2 reference signatures (binding differences may apply):
setFileMode(self, mode: PySide2.QtWidgets.QFileDialog.FileMode) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setFileMode
setFilter
setFilter(filters: Any) -> None
X.setFilter(filters)
Supplemental documentation: Qt 5 reference:
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.
This function was introduced in Qt 4.4.
See also filter().
Upstream PySide2 reference signatures (binding differences may apply):
setFilter(self, filters: PySide2.QtCore.QDir.Filters) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setFilter
setHistory
setHistory(paths: Any) -> None
X.setHistory(paths)
Supplemental documentation: Qt 5 reference:
void QFileDialog::setHistory(const QStringList \&paths)
Sets the browsing history of the filedialog to contain the given paths.
See also history().
Upstream PySide2 reference signatures (binding differences may apply):
setHistory(self, paths: typing.Sequence[str]) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setHistory
setIconProvider
setIconProvider(provider: Any) -> None
X.setIconProvider(provider)
Supplemental documentation: Qt 5 reference:
void QFileDialog::setIconProvider(QFileIconProvider *provider)
Sets the icon provider used by the filedialog to the specified provider.
See also iconProvider().
Upstream PySide2 reference signatures (binding differences may apply):
setIconProvider(self, provider: PySide2.QtWidgets.QFileIconProvider) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setIconProvider
setItemDelegate
setItemDelegate(delegate: Any) -> None
X.setItemDelegate(delegate)
Supplemental documentation: Qt 5 reference:
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.
See also itemDelegate(), setIconProvider(), and QFileSystemModel.
Upstream PySide2 reference signatures (binding differences may apply):
setItemDelegate(self, delegate: PySide2.QtWidgets.QAbstractItemDelegate) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setItemDelegate
setLabelText
setLabelText(label: Any, text: str) -> None
X.setLabelText(label, text)
Supplemental documentation: Qt 5 reference:
void QFileDialog::setLabelText(QFileDialog::DialogLabel label, const QString \&text)
Sets the text shown in the filedialog in the specified label.
See also labelText().
Upstream PySide2 reference signatures (binding differences may apply):
setLabelText(self, label: PySide2.QtWidgets.QFileDialog.DialogLabel, text: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setLabelText
setMimeTypeFilters
setMimeTypeFilters(filters: Any) -> None
X.setMimeTypeFilters(filters)
Supplemental documentation: Qt 5 reference:
void QFileDialog::setMimeTypeFilters(const QStringList \&filters)
Sets the filters used in the file dialog, from a list of MIME types.
Convenience method for setNameFilters(). Uses QMimeType to create a name filter from the glob patterns and description defined in each MIME type.
Use application/octet-stream for the "All files (*)" filter, since that is the base MIME type for all files.
Calling setMimeTypeFilters overrides any previously set name filters, and changes the return value of nameFilters().
QStringList mimeTypeFilters({"image/jpeg", // will show "JPEG image (*.jpeg *.jpg *.jpe)
"image/png", // will show "PNG image (*.png)"
"application/octet-stream" // will show "All files (*)"
});
QFileDialog dialog(this);
dialog.setMimeTypeFilters(mimeTypeFilters);
dialog.exec();
This function was introduced in Qt 5.2.
See also mimeTypeFilters().
Upstream PySide2 reference signatures (binding differences may apply):
setMimeTypeFilters(self, filters: typing.Sequence[str]) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setMimeTypeFilters
setNameFilter
setNameFilter(filter: str) -> None
X.setNameFilter(filter)
Supplemental documentation: Qt 5 reference:
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 filename-wildcard patterns, separated by spaces, then only the text contained in the parentheses is used as the filter. This means that these calls are all equivalent:
dialog.setNameFilter("All C++ files (*.cpp *.cc *.C *.cxx *.c++)");
dialog.setNameFilter("*.cpp *.cc *.C *.cxx *.c++");
Note: With Android's native file dialog, the mime type matching the given name filter is used because only mime types are supported.
This function was introduced in Qt 4.4.
See also setMimeTypeFilters() and setNameFilters().
Upstream PySide2 reference signatures (binding differences may apply):
setNameFilter(self, filter: str) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setNameFilter
setNameFilterDetailsVisible
setNameFilterDetailsVisible(enabled: bool) -> None
X.setNameFilterDetailsVisible(enabled)
Upstream PySide2 reference signatures (binding differences may apply):
setNameFilterDetailsVisible(self, enabled: bool) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setNameFilterDetailsVisible
setNameFilters
setNameFilters(filters: Any) -> None
X.setNameFilters(filters)
Supplemental documentation: Qt 5 reference:
void QFileDialog::setNameFilters(const QStringList \&filters)
Sets the filters used in the file dialog.
Note that the filter *.* is not portable, because the historical assumption that
the file extension determines the file type is not consistent on every operating system.
It is possible to have a file with no dot in its name (for example, Makefile). In a
native Windows file dialog, *.* will match such files, while in other types of
file dialogs it may not. So it is better to use * if you mean to select any file.
const QStringList filters({"Image files (*.png *.xpm *.jpg)",
"Text files (*.txt)",
"Any files (*)"
});
QFileDialog dialog(this);
dialog.setNameFilters(filters);
dialog.exec();
setMimeTypeFilters()
has the advantage of providing all possible name filters for each file type. For
example, JPEG images have three possible extensions; if your application can open such
files, selecting the image/jpeg mime type as a filter will allow you to open all of
them.
This function was introduced in Qt 4.4.
See also nameFilters().
Upstream PySide2 reference signatures (binding differences may apply):
setNameFilters(self, filters: typing.Sequence[str]) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setNameFilters
setOption
setOption(option: Any, on: bool) -> None
X.setOption(option, on)
Supplemental documentation: Qt 5 reference:
void QFileDialog::setOption(QFileDialog::Option option, bool on \= true)
Sets the given option to be enabled if on is true; otherwise, clears the given option.
Options (particularly the DontUseNativeDialogs option) should be set before changing dialog properties or showing the dialog.
Setting options while the dialog is visible is not guaranteed to have an immediate effect on the dialog (depending on the option and on the platform).
Setting options after changing other properties may cause these values to have no effect.
This function was introduced in Qt 4.5.
See also options and testOption().
Upstream PySide2 reference signatures (binding differences may apply):
setOption(self, option: PySide2.QtWidgets.QFileDialog.Option, on: bool=...) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setOption
setOptions
setOptions(options: Any) -> None
X.setOptions(options)
Upstream PySide2 reference signatures (binding differences may apply):
setOptions(self, options: PySide2.QtWidgets.QFileDialog.Options) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setOptions
setProxyModel
setProxyModel(model: Any) -> None
X.setProxyModel(model)
Supplemental documentation: Qt 5 reference:
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.
This function was introduced in Qt 4.3.
See also proxyModel().
Upstream PySide2 reference signatures (binding differences may apply):
setProxyModel(self, model: PySide2.QtCore.QAbstractProxyModel) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setProxyModel
setReadOnly
setReadOnly(enabled: bool) -> None
X.setReadOnly(enabled)
Upstream PySide2 reference signatures (binding differences may apply):
setReadOnly(self, enabled: bool) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setReadOnly
setResolveSymlinks
setResolveSymlinks(enabled: bool) -> None
X.setResolveSymlinks(enabled)
Upstream PySide2 reference signatures (binding differences may apply):
setResolveSymlinks(self, enabled: bool) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setResolveSymlinks
setSidebarUrls
setSidebarUrls(urls: Any) -> None
X.setSidebarUrls(urls)
Supplemental documentation: Qt 5 reference:
void QFileDialog::setSidebarUrls(const QList\<QUrl> \&urls)
Sets the urls that are located in the sidebar.
For instance:
QList<QUrl> urls;
urls << QUrl::fromLocalFile("/example-users/foo/Code/qt5")
<< QUrl::fromLocalFile(QStandardPaths::standardLocations(QStandardPaths::MusicLocation).first());
QFileDialog dialog;
dialog.setSidebarUrls(urls);
dialog.setFileMode(QFileDialog::AnyFile);
if(dialog.exec()) {
// ...
}
The file dialog will then look like this:

This function was introduced in Qt 4.3.
See also sidebarUrls().
Upstream PySide2 reference signatures (binding differences may apply):
setSidebarUrls(self, urls: typing.Sequence[PySide2.QtCore.QUrl]) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setSidebarUrls
setSupportedSchemes
setSupportedSchemes(schemes: Any) -> None
X.setSupportedSchemes(schemes)
Upstream PySide2 reference signatures (binding differences may apply):
setSupportedSchemes(self, schemes: typing.Sequence[str]) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setSupportedSchemes
setViewMode
setViewMode(mode: Any) -> None
X.setViewMode(mode)
Upstream PySide2 reference signatures (binding differences may apply):
setViewMode(self, mode: PySide2.QtWidgets.QFileDialog.ViewMode) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setViewMode
setVisible
setVisible(visible: bool) -> None
X.setVisible(visible)
Supplemental documentation: Qt 5 reference:
[override virtual] void QFileDialog::setVisible(bool visible)
Reimplements: QDialog::setVisible(bool visible).
Upstream PySide2 reference signatures (binding differences may apply):
setVisible(self, visible: bool) -> None
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#setVisible
sidebarUrls
sidebarUrls() -> tuple
X.sidebarUrls() -> tuple
Supplemental documentation: Qt 5 reference:
QList\<QUrl> QFileDialog::sidebarUrls() const
Returns a list of urls that are currently in the sidebar
This function was introduced in Qt 4.3.
See also setSidebarUrls().
Upstream PySide2 reference signatures (binding differences may apply):
sidebarUrls(self) -> typing.List[PySide2.QtCore.QUrl]
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#sidebarUrls
supportedSchemes
instance-attribute
supportedSchemes: Any
Qt 5 reference:
supportedSchemes : QStringList
This property holds the URL schemes that the file dialog should allow navigating to.
Setting this property allows to restrict the type of URLs the user will be able to select. It is a way for the application to declare the protocols it will support to fetch the file content. An empty list means that no restriction is applied (the default). Supported for local files ("file" scheme) is implicit and always enabled; it is not necessary to include it in the restriction.
This property was introduced in Qt 5.6.
Access functions:
| QStringList | supportedSchemes() const |
|---|---|
| void | setSupportedSchemes(const QStringList \&schemes) |
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#supportedSchemes
testOption
testOption(option: Any) -> bool
X.testOption(option) -> bool
Supplemental documentation: Qt 5 reference:
bool QFileDialog::testOption(QFileDialog::Option option) const
Returns true if the given option is enabled; otherwise, returns false.
This function was introduced in Qt 4.5.
See also options and setOption().
Upstream PySide2 reference signatures (binding differences may apply):
testOption(self, option: PySide2.QtWidgets.QFileDialog.Option) -> bool
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#testOption
urlSelected
urlSelected(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QFileDialog.urlSelected; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QFileDialog::urlSelected(const QUrl \&url)
When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empty) selected url.
This function was introduced in Qt 5.2.
See also currentUrlChanged() and QDialog::Accepted.
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#urlSelected
urlsSelected
urlsSelected(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QFileDialog.urlsSelected; argument details are not documented.
Supplemental documentation: Qt 5 reference:
[signal] void QFileDialog::urlsSelected(const QList\<QUrl> \&urls)
When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empty) list of selected urls.
This function was introduced in Qt 5.2.
See also currentUrlChanged() and QDialog::Accepted.
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#urlsSelected
viewMode
instance-attribute
viewMode: Any
Qt 5 reference:
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.
Access functions:
| QFileDialog::ViewMode | viewMode() const |
|---|---|
| void | setViewMode(QFileDialog::ViewMode mode) |
See also ViewMode.
Source: https://doc.qt.io/archives/qt-5.15/qfiledialog.html#viewMode
windowIconChanged
windowIconChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QFileDialog.windowIconChanged; argument details are not documented.
windowIconTextChanged
windowIconTextChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QFileDialog.windowIconTextChanged; argument details are not documented.
windowTitleChanged
windowTitleChanged(*args: Any, **kwargs: Any) -> Any
Native PythonQt.QtGui.QFileDialog.windowTitleChanged; argument details are not documented.