From b7170f97d41127f8e9ed82cbdc9fbdd725d4d63e Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Mon, 1 Jul 2024 01:17:16 +0300 Subject: [PATCH] QTemporaryFile: de-duplicate API docs wrt. default file name template This also fixes a discrepancy in fileTemplate() API docs. Pick-to: 6.7 Change-Id: Ie36278417406848db2a9759e996ce98b87d19f89 Reviewed-by: Thiago Macieira (cherry picked from commit 7fc2eae710c885e5152ed37c75fe6993c36c7171) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/io/qtemporaryfile.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 9107b800c5d..201ddf35abe 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -633,12 +633,17 @@ QTemporaryFile::QTemporaryFile(const QString &templateName) #else /*! - Constructs a QTemporaryFile using as file template - the application name returned by QCoreApplication::applicationName() - (otherwise \c qt_temp) followed by ".XXXXXX". - The file is stored in the system's temporary directory, QDir::tempPath(). + Constructs a QTemporaryFile. - \sa setFileTemplate(), QDir::tempPath() +//! [default-file-name-template] + \keyword Default File Name Template + The default file name template is determined from the application name as + returned by QCoreApplication::applicationName() (or \c {"qt_temp"} if the + application name is empty), followed by \c {".XXXXXX"}. The file is stored + in the system's temporary directory, as returned by QDir::tempPath(). +//! [default-file-name-template] + + \sa setFileTemplate(), fileTemplate(), fileName(), QDir::tempPath() */ QTemporaryFile::QTemporaryFile() : QTemporaryFile(nullptr) @@ -672,10 +677,9 @@ QTemporaryFile::QTemporaryFile(const QString &templateName) } /*! - Constructs a QTemporaryFile (with the given \a parent) - using as file template the application name returned by QCoreApplication::applicationName() - (otherwise \c qt_temp) followed by ".XXXXXX". - The file is stored in the system's temporary directory, QDir::tempPath(). + Constructs a QTemporaryFile with the given \a parent. + + \include qtemporaryfile.cpp default-file-name-template \sa setFileTemplate() */ @@ -796,10 +800,9 @@ QString QTemporaryFile::fileName() const } /*! - Returns the set file template. The default file template will be - called qcoreappname.XXXXXX and be placed in QDir::tempPath(). + Returns the file name template. - \sa setFileTemplate() + \sa setFileTemplate(), fileName(), {Default File Name Template} */ QString QTemporaryFile::fileTemplate() const {