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.

Change-Id: If3c0ebe299281a3c0ffc2d9e609b89df2578811d
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit a315a9e70e69e36cef0e51058faad048773040e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Jøger Hansegård 2024-11-20 14:25:59 +01:00 committed by Qt Cherry-pick Bot
parent bb4ec722d4
commit 4aa38ca8a6

View File

@ -2410,9 +2410,10 @@ encoded in \1, and is converted to QString using the \2 function.
/*! \fn QString QString::fromWCharArray(const wchar_t *string, qsizetype size) /*! \fn QString QString::fromWCharArray(const wchar_t *string, qsizetype size)
\since 4.2 \since 4.2
Returns a copy of the \a string, where the encoding of \a string depends on Reads the first \a size code units of the \c wchar_t array to whose start
the size of wchar. If wchar is 4 bytes, the \a string is interpreted as \a string points, converting them to Unicode and returning the result as
UCS-4, if wchar is 2 bytes it is interpreted as UTF-16. 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. If \a size is -1 (default), the \a string must be '\\0'-terminated.