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>
This commit is contained in:
Jøger Hansegård 2024-11-20 14:25:59 +01:00
parent ea88b0e244
commit a315a9e70e

View File

@ -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.