From fcfa24547460159ccc73cebcd11d409658143bfe Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Thu, 4 Jul 2024 03:06:54 +0300 Subject: [PATCH] QTemporaryFile: clarify usage of the dynamic part of the file name Pick-to: 6.7 Change-Id: I7d6b1b8a53f7b32bf223ac3435ec7c13c9326d10 Reviewed-by: Ivan Solovev Reviewed-by: Edward Welbourne (cherry picked from commit b4bb4449aea7592afdb9b9134bb90c40fe29735a) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/io/qtemporaryfile.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index c4e50d2174d..74a6f731cb8 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -605,11 +605,12 @@ QString QTemporaryFilePrivate::defaultTemplateName() as the temporary file itself was created on. //! [note-about-rename-method] - Specified filenames can contain the following template \c XXXXXX - (six upper case "X" characters), which will be replaced by the - auto-generated portion of the filename. Note that the template is - case sensitive. If the template is not present in the filename, - QTemporaryFile appends the generated part to the filename given. + The file name (the part after the last directory path separator in the + specified file template) can contain the special sequence \c {"XXXXXX"} + (at least six upper case \c "X" characters), which will be replaced with + the auto-generated portion of the file name. If the file name doesn't + contain \c {"XXXXXX"}, QTemporaryFile will append the generated part to the + file name. Only the first occurrence of \c {"XXXXXX"} will be considered. \note On Linux, QTemporaryFile will attempt to create unnamed temporary files. If that succeeds, open() will return true but exists() will be @@ -665,7 +666,8 @@ QTemporaryFile::QTemporaryFile() //! [file-created-on-open] //! [dynamic-part-of-filename] - If \a templateName doesn't contain \c {"XXXXXX"}, it will be added + If the file name (the part after the last directory path separator in + \a templateName) doesn't contain \c {"XXXXXX"}, it will be added automatically. \c {"XXXXXX"} will be replaced with the dynamic part of the file name,