diff --git a/src/corelib/text/qstringconverter.h b/src/corelib/text/qstringconverter.h index 7443173df6..989773e113 100644 --- a/src/corelib/text/qstringconverter.h +++ b/src/corelib/text/qstringconverter.h @@ -327,6 +327,28 @@ struct QConcatenable> out = s.decoder->decodeIntoBuffer(out, s.data.data(), s.data.length()); } }; + +template +QString &operator+=(QString &a, const QStringDecoder::EncodedData &b) +{ + qsizetype len = a.size() + QConcatenable>::size(b); + a.reserve(len); + QChar *it = a.data() + a.size(); + QConcatenable>::appendTo(b, it); + a.resize(qsizetype(it - a.constData())); //may be smaller than len + return a; +} + +template +QByteArray &operator+=(QByteArray &a, const QStringEncoder::DecodedData &b) +{ + qsizetype len = a.size() + QConcatenable>::size(b); + a.reserve(len); + char *it = a.data() + a.size(); + QConcatenable>::appendTo(b, it); + a.resize(qsizetype(it - a.constData())); //may be smaller than len + return a; +} #endif QT_END_NAMESPACE