7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtCore/qdir.h>
9#include <QtCore/qstring.h>
10#include <QtCore/qurl.h>
11#include <QtWidgets/qdialog.h>
49 ShowDirsOnly = 0x00000001,
50 DontResolveSymlinks = 0x00000002,
51 DontConfirmOverwrite = 0x00000004,
52 DontUseNativeDialog = 0x00000008,
53 ReadOnly = 0x00000010,
54 HideNameFilterDetails = 0x00000020,
55 DontUseCustomDirectoryIcons = 0x00000040
73 QUrl directoryUrl()
const;
75 void selectFile(
const QString &filename);
78 void selectUrl(
const QUrl &
url);
79 QList<QUrl> selectedUrls()
const;
85 QString selectedMimeTypeFilter()
const;
86 QString selectedNameFilter()
const;
88#if QT_CONFIG(mimetype)
94 QDir::Filters
filter()
const;
95 void setFilter(QDir::Filters
filters);
98 ViewMode viewMode()
const;
101 FileMode fileMode()
const;
103 void setAcceptMode(AcceptMode
mode);
104 AcceptMode acceptMode()
const;
106 void setSidebarUrls(
const QList<QUrl> &urls);
107 QList<QUrl> sidebarUrls()
const;
112 void setDefaultSuffix(
const QString &suffix);
127 void setSupportedSchemes(
const QStringList &schemes);
130#if QT_CONFIG(proxymodel)
137 void setOptions(
Options options);
142 void setVisible(
bool visible)
override;
163 QString *selectedFilter =
nullptr,
166 static QUrl getOpenFileUrl(
QWidget *parent =
nullptr,
170 QString *selectedFilter =
nullptr,
178 QString *selectedFilter =
nullptr,
181 static QUrl getSaveFileUrl(
QWidget *parent =
nullptr,
185 QString *selectedFilter =
nullptr,
192 Options options = ShowDirsOnly);
194 static QUrl getExistingDirectoryUrl(
QWidget *parent =
nullptr,
197 Options options = ShowDirsOnly,
204 QString *selectedFilter =
nullptr,
207 static QList<QUrl> getOpenFileUrls(
QWidget *parent =
nullptr,
211 QString *selectedFilter =
nullptr,
215 static void getOpenFileContent(
const QString &nameFilter,
216 const std::function<
void(
const QString &,
const QByteArray &)> &fileContentsReady,
219 static void saveFileContent(
const QByteArray &fileContent,
223#if QT_WIDGETS_REMOVED_SINCE(6, 7)
224 static void getOpenFileContent(
const QString &nameFilter,
225 const std::function<
void(
const QString &,
const QByteArray &)> &fileContentsReady);
226 static void saveFileContent(
const QByteArray &fileContent,
234 void accept()
override;
235 void changeEvent(
QEvent *e)
override;
245{ setDirectory(adirectory.absolutePath()); }
The QAbstractItemDelegate class is used to display and edit data items from a model.
The QAbstractProxyModel class provides a base class for proxy item models that can do sorting,...
The QDialog class is the base class of dialog windows.
The QFileDialog class provides a dialog that allows users to select files or directories.
FileMode
This enum is used to indicate what the user may select in the file dialog; that is,...
void currentChanged(const QString &path)
When the current file changes for local operations, this signal is emitted with the new file name as ...
void urlsSelected(const QList< QUrl > &urls)
When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empt...
void filesSelected(const QStringList &files)
When the selection changes for local operations and the dialog is accepted, this signal is emitted wi...
void fileSelected(const QString &file)
When the selection changes for local operations and the dialog is accepted, this signal is emitted wi...
void currentUrlChanged(const QUrl &url)
When the current file changes, this signal is emitted with the new file URL as the url parameter.
void filterSelected(const QString &filter)
DialogLabel
\value LookIn \value FileName \value FileType \value Accept \value Reject
void urlSelected(const QUrl &url)
When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empt...
AcceptMode
\value AcceptOpen \value AcceptSave
void directoryUrlEntered(const QUrl &directory)
This signal is emitted when the user enters a directory.
ViewMode
This enum describes the view mode of the file dialog; that is, what information about each file is di...
void directoryEntered(const QString &directory)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Combined button and popup list for selecting options.
QList< QString > QStringList
Constructs a string list that contains the given string, str.
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
GLsizei const GLuint * paths
GLuint GLsizei const GLchar * label
[43]
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLsizei const GLchar *const * path
#define QT_REQUIRE_CONFIG(feature)
QSqlQueryModel * model
[16]
file open(QIODevice::ReadOnly)
QUrl url("example.com")
[constructor-url-reference]
QStringList mimeTypeFilters({"image/jpeg", "image/png", "application/octet-stream" })
[12]
dialog setViewMode(QFileDialog::Detail)
[3]
dialog setNameFilter(tr("Images (*.png *.xpm *.jpg)"))
[2]
dialog setMimeTypeFilters(mimeTypeFilters)
dialog setNameFilters(filters)
dialog setFileMode(QFileDialog::AnyFile)
const QStringList filters({"Image files (*.png *.xpm *.jpg)", "Text files (*.txt)", "Any files (*)" })
[6]