QFileDialog Class
Header:#include < QFileDialog >
qmake:QT += widgets
Inherits:QDialog
Public Types
enum AcceptMode { AcceptOpen, AcceptSave }
enum DialogLabel { LookIn, FileName, FileType, Accept, Reject }
enum FileMode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly }
enum Option { ShowDirsOnly, DontResolveSymlinks, DontConfirmOverwrite, DontUseNativeDialog, ReadOnly, …, DontUseCustomDirectoryIcons }
flags Options
enum ViewMode { Detail, List }
Properties
acceptMode : AcceptMode
defaultSuffix : QString
fileMode : FileMode
options : Options
supportedSchemes : QStringList
viewMode : ViewMode
Public Functions
QFileDialog(QWidget *parent = nullptr, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString())
QFileDialog(QWidget *parent, Qt::WindowFlags flags)
virtual ~QFileDialog()
QFileDialog::AcceptMode acceptMode() const
QString defaultSuffix() const
QDir directory() const
QUrl directoryUrl() const
QFileDialog::FileMode fileMode() const
QDir::Filters filter() const
QStringList history() const
QFileIconProvider *iconProvider() const
QAbstractItemDelegate *itemDelegate() const
QString labelText(QFileDialog::DialogLabel label) const
QStringList mimeTypeFilters() const
QStringList nameFilters() const
void open(QObject *receiver, const char *member)
QFileDialog::Options options() const
QAbstractProxyModel *proxyModel() const
bool restoreState(const QByteArray &state)
QByteArray saveState() const
void selectFile(const QString &filename)
void selectMimeTypeFilter(const QString &filter)
void selectNameFilter(const QString &filter)
void selectUrl(const QUrl &url)
QStringList selectedFiles() const
QString selectedMimeTypeFilter() const
QString selectedNameFilter() const
QList<QUrl> selectedUrls() const
void setAcceptMode(QFileDialog::AcceptMode mode)
void setDefaultSuffix(const QString &suffix)
void setDirectory(const QString &directory)
void setDirectory(const QDir &directory)
void setDirectoryUrl(const QUrl &directory)
void setFileMode(QFileDialog::FileMode mode)
void setFilter(QDir::Filters filters)
void setHistory(const QStringList &paths)
void setIconProvider(QFileIconProvider *provider)
void setItemDelegate(QAbstractItemDelegate *delegate)
void setLabelText(QFileDialog::DialogLabel label, const QString &text)
void setMimeTypeFilters(const QStringList &filters)
void setNameFilter(const QString &filter)
void setNameFilters(const QStringList &filters)
void setOption(QFileDialog::Option option, bool on = true)
void setOptions(QFileDialog::Options options)
void setProxyModel(QAbstractProxyModel *proxyModel)
void setSidebarUrls(const QList<QUrl> &urls)
void setSupportedSchemes(const QStringList &schemes)
void setViewMode(QFileDialog::ViewMode mode)
QList<QUrl> sidebarUrls() const
QStringList supportedSchemes() const
bool testOption(QFileDialog::Option option) const
QFileDialog::ViewMode viewMode() const
Reimplemented Public Functions
virtual void setVisible(bool visible) override
Signals
void currentChanged(const QString &path)
void currentUrlChanged(const QUrl &url)
void directoryEntered(const QString &directory)
void directoryUrlEntered(const QUrl &directory)
void fileSelected(const QString &file)
void filesSelected(const QStringList &selected)
void filterSelected(const QString &filter)
void urlSelected(const QUrl &url)
void urlsSelected(const QList<QUrl> &urls)
Static Public Members
QString getExistingDirectory(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), QFileDialog::Options options = ShowDirsOnly)
QUrl getExistingDirectoryUrl(QWidget *parent = nullptr, const QString &caption = QString(), const QUrl &dir = QUrl(), QFileDialog::Options options = ShowDirsOnly, const QStringList &supportedSchemes = QStringList())
void getOpenFileContent(const QString &nameFilter, const std::function<void (const QString &, const QByteArray &)> &fileOpenCompleted)
QString getOpenFileName(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = Options())
QStringList getOpenFileNames(QWidget *parent = nullptr, const QString &caption = QString(), const QString &dir = QString(), const QString &filter = QString(), QString *selectedFilter = nullptr, QFileDialog::Options options = Options())
QUrl getOpenFileUrl(QWidget *parent = nullptr, const QString &caption = QString(), const QUrl &dir = QUrl(), const QString &filter