summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstring.cpp
diff options
context:
space:
mode:
authorJøger Hansegård <joger.hansegard@qt.io>2024-11-20 14:25:59 +0100
committerJøger Hansegård <joger.hansegard@qt.io>2024-11-23 18:29:40 +0000
commita315a9e70e69e36cef0e51058faad048773040e1 (patch)
tree292d37db12c7bd1f29c6ee482dc0536c02957b53 /src/corelib/text/qstring.cpp
parentea88b0e244ab077288bf6915118bf6b6745182c6 (diff)
Document that size is number of code units in QString::fromWCharArray
Other functions that creates QString instances from buffers document that the size argument represents the number of characters to copy. This patch adds this statement to QString::fromWCharArray too, but makes it explicit that the size represents the number of code units. Pick-to: 6.8 Change-Id: If3c0ebe299281a3c0ffc2d9e609b89df2578811d Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Diffstat (limited to 'src/corelib/text/qstring.cpp')
-rw-r--r--src/corelib/text/qstring.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 7d2d675f2ba..f09fd57037b 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -2402,9 +2402,10 @@ encoded in \1, and is converted to QString using the \2 function.
/*! \fn QString QString::fromWCharArray(const wchar_t *string, qsizetype size)
\since 4.2
- Returns a copy of the \a string, where the encoding of \a string depends on
- the size of wchar. If wchar is 4 bytes, the \a string is interpreted as
- UCS-4, if wchar is 2 bytes it is interpreted as UTF-16.
+ Reads the first \a size code units of the \c wchar_t array to whose start
+ \a string points, converting them to Unicode and returning the result as
+ a QString. The encoding used by \c wchar_t is assumed to be UCS-4 if the
+ type's size is four bytes or UTF-16 if its size is two bytes.
If \a size is -1 (default), the \a string must be '\\0'-terminated.