diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 5ee4102cdb..0682395ebf 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -5448,6 +5448,7 @@ QString QString::fromUtf8_helper(const char *str, int size) } /*! + \since 5.3 Returns a QString initialized with the first \a size characters of the Unicode string \a unicode (ISO-10646-UTF-16 encoded). @@ -5463,7 +5464,7 @@ QString QString::fromUtf8_helper(const char *str, int size) \sa utf16(), setUtf16(), fromStdU16String() */ -QString QString::fromUtf16(const ushort *unicode, int size) +QString QString::fromUtf16(const char16_t *unicode, int size) { if (!unicode) return QString(); @@ -5476,39 +5477,22 @@ QString QString::fromUtf16(const ushort *unicode, int size) } /*! - \fn QString QString::fromUtf16(const char16_t *str, int size) - \since 5.3 + \fn QString QString::fromUtf16(const ushort *str, int size) + \obsolete - Returns a QString initialized with the first \a size characters - of the Unicode string \a str (ISO-10646-UTF-16 encoded). - - If \a size is -1 (default), \a str must be \\0'-terminated. - - This function checks for a Byte Order Mark (BOM). If it is missing, - host byte order is assumed. - - This function is slow compared to the other Unicode conversions. - Use QString(const QChar *, int) or QString(const QChar *) if possible. - - QString makes a deep copy of the Unicode data. - - \sa utf16(), setUtf16(), fromStdU16String() -*/ - -/*! - \fn QString QString::fromUcs4(const char32_t *str, int size) - \since 5.3 - - Returns a QString initialized with the first \a size characters - of the Unicode string \a str (ISO-10646-UCS-4 encoded). - - If \a size is -1 (default), \a str must be \\0'-terminated. - - \sa toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), fromStdU32String() + Use the \c char16_t overload. */ /*! + \fn QString QString::fromUcs4(const uint *str, int size) \since 4.2 + \obsolete + + Use the \c char32_t overload instead. +*/ + +/*! + \since 5.3 Returns a QString initialized with the first \a size characters of the Unicode string \a unicode (ISO-10646-UCS-4 encoded). @@ -5517,7 +5501,7 @@ QString QString::fromUtf16(const ushort *unicode, int size) \sa toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), fromStdU32String() */ -QString QString::fromUcs4(const uint *unicode, int size) +QString QString::fromUcs4(const char32_t *unicode, int size) { if (!unicode) return QString(); diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 229dc17a28..a7cafced31 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -720,15 +720,17 @@ public: { return str.isNull() ? QString() : fromUtf8(str.data(), qstrnlen(str.constData(), str.size())); } static inline QString fromLocal8Bit(const QByteArray &str) { return str.isNull() ? QString() : fromLocal8Bit(str.data(), qstrnlen(str.constData(), str.size())); } - static QString fromUtf16(const ushort *, int size = -1); - static QString fromUcs4(const uint *, int size = -1); + static QString fromUtf16(const char16_t *, int size = -1); + static QString fromUcs4(const char32_t *, int size = -1); static QString fromRawData(const QChar *, int size); -#if defined(Q_COMPILER_UNICODE_STRINGS) - static QString fromUtf16(const char16_t *str, int size = -1) - { return fromUtf16(reinterpret_cast(str), size); } - static QString fromUcs4(const char32_t *str, int size = -1) - { return fromUcs4(reinterpret_cast(str), size); } +#if QT_DEPRECATED_SINCE(6, 0) + QT_DEPRECATED_VERSION_X_6_0("Use char16_t* overload.") + static QString fromUtf16(const ushort *str, int size = -1) + { return fromUtf16(reinterpret_cast(str), size); } + QT_DEPRECATED_VERSION_X_6_0("Use char32_t* overload.") + static QString fromUcs4(const uint *str, int size = -1) + { return fromUcs4(reinterpret_cast(str), size); } #endif inline int toWCharArray(wchar_t *array) const;