diff options
author | Mate Barany <mate.barany@qt.io> | 2022-11-14 16:02:05 +0100 |
---|---|---|
committer | Mate Barany <mate.barany@qt.io> | 2022-12-02 16:04:06 +0100 |
commit | 2ffdb3bcddb2528c95571f7eaee270c5d56ab13d (patch) | |
tree | 1e2cb167e6ac9fc48cecd69b23810ba768a58816 /src/corelib | |
parent | d2e1d73bf1e63ad5867e654c37c84f56fcf19d20 (diff) |
QString: overload the += operator to handle QUtf8StringView
The += operator is already overloaded to handle QStringView and
QLatin1String - add the missing QUtf8StringView overload.
[ChangeLog][QtCore][QString] Added operator+=(QUtf8StringView)
overload.
Task-number: QTBUG-103302
Change-Id: Iec6940bad7866310c826a130b98accebc3c82aa8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/text/qstring.cpp | 9 | ||||
-rw-r--r-- | src/corelib/text/qstring.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 4ca66a2634..326435f28f 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -6195,7 +6195,14 @@ QString& QString::fill(QChar ch, qsizetype size) \overload operator+=() - Appends the Latin-1 string \a str to this string. + Appends the Latin-1 string view \a str to this string. +*/ + +/*! \fn QString &QString::operator+=(QUtf8StringView str) + \since 6.5 + \overload operator+=() + + Appends the UTF-8 string view \a str to this string. */ /*! \fn QString &QString::operator+=(const QByteArray &ba) diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 74dcf3986a..16ab13e1e9 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -706,6 +706,7 @@ public: inline QString &operator+=(const QString &s) { return append(s); } inline QString &operator+=(QStringView v) { return append(v); } inline QString &operator+=(QLatin1StringView s) { return append(s); } + QString &operator+=(QUtf8StringView s) { return append(s); } QString &remove(qsizetype i, qsizetype len); QString &remove(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive); |