diff options
author | Paul Wicking <paul.wicking@qt.io> | 2021-06-23 09:33:10 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-23 19:37:39 +0000 |
commit | ed4ed7c2d4abfde7d3fd3316410d3b5004a6263f (patch) | |
tree | c18c4c7b756f0703e80d116ebe9a343e1b01e674 | |
parent | 8fd51adaf930eedb8323d314fa377d9606fa8373 (diff) | |
download | qtbase-ed4ed7c2d4abfde7d3fd3316410d3b5004a6263f.tar.gz |
Extend documentation for QFile:copy()
- Add information about symlinks and file metadata.
- Reflow text.
- Extract text common to both overloads to a .qdocinc file
for consistency and to avoid duplication.
Fixes: QTBUG-94706
Change-Id: I3c730fd63f4018a1a573bb56751fedd2270a3247
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cc2fdce35e6a958e021b4d4cdc0ace1a91b06d0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/corelib/doc/src/includes/qfile-copy.qdocinc | 11 | ||||
-rw-r--r-- | src/corelib/io/qfile.cpp | 14 |
2 files changed, 15 insertions, 10 deletions
diff --git a/src/corelib/doc/src/includes/qfile-copy.qdocinc b/src/corelib/doc/src/includes/qfile-copy.qdocinc new file mode 100644 index 0000000000..5ff68eac81 --- /dev/null +++ b/src/corelib/doc/src/includes/qfile-copy.qdocinc @@ -0,0 +1,11 @@ +This file is closed before it is copied. + +If the copied file is a symbolic link (symlink), the +file it refers to is copied, not the link itself. With the +exception of permissions, which are copied, no other file metadata +is copied. + +Returns \c true if successful; otherwise returns \c false. + +Note that if a file with the name \a newName already exists, +copy() returns \c false. This means QFile will not overwrite it. diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index 6bc66c9c8e..5da126470c 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -829,13 +829,9 @@ QFile::link(const QString &fileName, const QString &linkName) } /*! - Copies the file currently specified by fileName() to a file called - \a newName. Returns \c true if successful; otherwise returns \c false. + Copies the file named fileName() to \a newName. - Note that if a file with the name \a newName already exists, - copy() returns \c false (i.e. QFile will not overwrite it). - - The source file is closed before it is copied. + \include qfile-copy.qdocinc \sa setFileName() */ @@ -941,11 +937,9 @@ QFile::copy(const QString &newName) /*! \overload - Copies the file \a fileName to \a newName. Returns \c true if successful; - otherwise returns \c false. + Copies the file named \a fileName to \a newName. - If a file with the name \a newName already exists, copy() returns \c false - (i.e., QFile will not overwrite it). + \include qfile-copy.qdocinc \sa rename() */ |