diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-12-30 16:06:31 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-01-02 12:51:37 +0000 |
commit | 79bf4e8f1c4415d92ab335c5a72b9e4c9332fdd3 (patch) | |
tree | f4a62a13437d945b18840c882c5951767ad4b4ec | |
parent | 59ae55e12e075005ceae6e353ef1ee00817ec751 (diff) |
Added QSaveFile to the bootstrap library
It's quite a simple addition and required for the ahead of time compilation
tool for qtdeclarative.
Change-Id: Iba85ae5182919cdb5ab15a0b643e57c103eae632
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/corelib/io/qsavefile.cpp | 20 | ||||
-rw-r--r-- | src/corelib/io/qsavefile.h | 4 | ||||
-rw-r--r-- | src/tools/bootstrap/bootstrap.pro | 1 |
3 files changed, 20 insertions, 5 deletions
diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp index 0254eb984f..d8166014db 100644 --- a/src/corelib/io/qsavefile.cpp +++ b/src/corelib/io/qsavefile.cpp @@ -104,13 +104,14 @@ QSaveFilePrivate::~QSaveFilePrivate() \sa QTextStream, QDataStream, QFileInfo, QDir, QFile, QTemporaryFile */ -/*! - Constructs a new file object with the given \a parent. -*/ -QSaveFile::QSaveFile(QObject *parent) - : QFileDevice(*new QSaveFilePrivate, parent) +#ifdef QT_NO_QOBJECT +QSaveFile::QSaveFile(const QString &name) + : QFileDevice(*new QSaveFilePrivate) { + Q_D(QSaveFile); + d->fileName = name; } +#else /*! Constructs a new file object to represent the file with the given \a name. */ @@ -120,6 +121,14 @@ QSaveFile::QSaveFile(const QString &name) Q_D(QSaveFile); d->fileName = name; } + +/*! + Constructs a new file object with the given \a parent. +*/ +QSaveFile::QSaveFile(QObject *parent) + : QFileDevice(*new QSaveFilePrivate, parent) +{ +} /*! Constructs a new file object with the given \a parent to represent the file with the specified \a name. @@ -130,6 +139,7 @@ QSaveFile::QSaveFile(const QString &name, QObject *parent) Q_D(QSaveFile); d->fileName = name; } +#endif /*! Destroys the file object, discarding the saved contents unless commit() was called. diff --git a/src/corelib/io/qsavefile.h b/src/corelib/io/qsavefile.h index 0a6af91261..09d6e29272 100644 --- a/src/corelib/io/qsavefile.h +++ b/src/corelib/io/qsavefile.h @@ -58,14 +58,18 @@ class QSaveFilePrivate; class Q_CORE_EXPORT QSaveFile : public QFileDevice { +#ifndef QT_NO_QOBJECT Q_OBJECT +#endif Q_DECLARE_PRIVATE(QSaveFile) public: explicit QSaveFile(const QString &name); +#ifndef QT_NO_QOBJECT explicit QSaveFile(QObject *parent = Q_NULLPTR); explicit QSaveFile(const QString &name, QObject *parent); +#endif ~QSaveFile(); QString fileName() const Q_DECL_OVERRIDE; diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 0a61497588..0e0fe7932e 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -46,6 +46,7 @@ SOURCES += \ ../../corelib/io/qresource.cpp \ ../../corelib/io/qtemporaryfile.cpp \ ../../corelib/io/qtextstream.cpp \ + ../../corelib/io/qsavefile.cpp \ ../../corelib/io/qstandardpaths.cpp \ ../../corelib/io/qloggingcategory.cpp \ ../../corelib/io/qloggingregistry.cpp \ |