diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2022-05-02 14:54:20 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2022-05-03 11:44:56 +0200 |
| commit | 7905b624fda19960f85cfada6b84e416d738a22a (patch) | |
| tree | f208afd8ee3ecc9b98277ff538ae84a55b7fd182 /src/corelib/serialization/qtextstream.cpp | |
| parent | 175cc7f7c0cfab45e67b04764c2753903df10981 (diff) | |
QTextStream: fix streaming of char16_t's
Clazy complains about all uses of QLatin1Char these days, but if one
actually applies the fixit to turn
out << QLatin1Char(' ');
into
out << u' ';
the space is now streamed as an int (20), not as a space.
Fix by providing an explicit char16_t overload.
[ChangeLog][QtCore][QTextStream] Added op<<(char16_t).
[ChangeLog][Important Behavior Changes] QTextStream streams char16_t's
as QChars now instead of outputting the numeric value. If you want to
preserve the old behavior, cast the char16_t to a numeric type, such
as ushort or int, and stream that. This is backwards-compatible.
Pick-to: 6.3
Change-Id: I42d422cdebb27d38ac1714b22ef186642ec407e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/serialization/qtextstream.cpp')
| -rw-r--r-- | src/corelib/serialization/qtextstream.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/serialization/qtextstream.cpp b/src/corelib/serialization/qtextstream.cpp index aaed1a905e7..a29be8969ae 100644 --- a/src/corelib/serialization/qtextstream.cpp +++ b/src/corelib/serialization/qtextstream.cpp @@ -2288,6 +2288,15 @@ QTextStream &QTextStream::operator<<(char c) } /*! + \fn QTextStream &QTextStream::operator<<(char16_t c) + \overload + \since 6.3.1 + + Writes the Unicode character \a c to the stream, then returns a + reference to the QTextStream. +*/ + +/*! Writes the integer number \a i to the stream, then returns a reference to the QTextStream. By default, the number is stored in decimal form, but you can also set the base by calling |
