8#include <QtCore/qglobal.h>
10#if QT_CONFIG(temporaryfile)
12#include <QtCore/qfiledevice.h>
13#include <QtCore/qstring.h>
16#error qsavefile.h must be included before any header file that defines open
21class QAbstractFileEngine;
22class QSaveFilePrivate;
24class Q_CORE_EXPORT QSaveFile :
public QFileDevice
27 Q_DECLARE_PRIVATE(QSaveFile)
30#if QT_CORE_REMOVED_SINCE(6
, 11
)
31 explicit QSaveFile(
const QString &name);
33 explicit QSaveFile(QObject *parent =
nullptr);
34 explicit QSaveFile(
const QString &name, QObject *parent =
nullptr);
37 QString fileName()
const override;
38 void setFileName(
const QString &name);
40 QFILE_MAYBE_NODISCARD
bool open(OpenMode flags) override;
45 void setDirectWriteFallback(
bool enabled);
46 bool directWriteFallback()
const;
48#if QT_CONFIG(cxx17_filesystem) || defined(Q_QDOC)
49 Q_WEAK_OVERLOAD QSaveFile(
const std::filesystem::path &path, QObject *parent =
nullptr)
50 : QSaveFile(QtPrivate::fromFilesystemPath(path), parent)
54 std::filesystem::path filesystemFileName()
const
55 {
return QtPrivate::toFilesystemPath(fileName()); }
56 Q_WEAK_OVERLOAD
void setFileName(
const std::filesystem::path &name)
58 setFileName(QtPrivate::fromFilesystemPath(name));
63 qint64 writeData(
const char *data, qint64 len) override;
66 void close() override;
67#if !QT_CONFIG(translation)
68 static QString tr(
const char *string) {
return QString::fromLatin1(string); }
72 Q_DISABLE_COPY(QSaveFile)
73 friend class QFilePrivate;
Combined button and popup list for selecting options.
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
static Q_DECL_COLD_FUNCTION bool file_already_open(QFile &file, const char *where=nullptr)
#define QFILEINFO_MAYBE_EXPLICIT
QList< QFileInfo > QFileInfoList