diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-29 11:22:01 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-08-04 17:29:54 +0000 |
commit | 38bc95aeceea5b4edbcfaee446d94b6062530770 (patch) | |
tree | 2fb9990811e255230ad05885c4026f348b316f72 /src/corelib/io/qtemporaryfile.h | |
parent | 363dc9146e53e24172bb9c0ae68100a8543bd9ae (diff) |
QTemporaryFile: add a simpler rename() (non-virtual) override
Calling the parent version is still ok, but if you call the new one you
get a bit of benefit. Since we control the file name, we don't have to
worry about a case-changing renaming (by choice). We also know that the
file is a regular one, because we created it.
[ChangeLog][Important Behavior Changes][QTemporaryFile] rename() no
longer attempts to do block copying, as that usually indicates a mistake
in the user's code. Instead, either create the temporary file in the
same directory as the new name to be, or use QSaveFile.
Change-Id: I1eba2b016de74620bfc8fffd14ccaac0cdb9fe87
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/corelib/io/qtemporaryfile.h')
-rw-r--r-- | src/corelib/io/qtemporaryfile.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/io/qtemporaryfile.h b/src/corelib/io/qtemporaryfile.h index 3dc2e75f50..7fc5a299fc 100644 --- a/src/corelib/io/qtemporaryfile.h +++ b/src/corelib/io/qtemporaryfile.h @@ -80,6 +80,10 @@ public: QString fileName() const Q_DECL_OVERRIDE; QString fileTemplate() const; void setFileTemplate(const QString &name); + + // Hides QFile::rename + bool rename(const QString &newName); + #if QT_DEPRECATED_SINCE(5,1) QT_DEPRECATED inline static QTemporaryFile *createLocalFile(const QString &fileName) { return createNativeFile(fileName); } |