diff options
-rw-r--r-- | src/corelib/text/qstring.cpp | 9 | ||||
-rw-r--r-- | src/corelib/text/qstring.h | 1 | ||||
-rw-r--r-- | tests/auto/corelib/text/qstring/tst_qstring.cpp | 2 |
3 files changed, 11 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); diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 35596976f9..0c266a7da8 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -440,6 +440,8 @@ private slots: void operator_pluseq_qstringview_data() { operator_pluseq_data(EmptyIsNoop); } void operator_pluseq_qlatin1string() { operator_pluseq_impl<QLatin1String, QString &(QString::*)(QLatin1String)>(); } void operator_pluseq_qlatin1string_data() { operator_pluseq_data(Latin1Encoded); } + void operator_pluseq_qutf8stringview() { operator_pluseq_impl<QUtf8StringView, QString &(QString::*)(QUtf8StringView)>(); } + void operator_pluseq_qutf8stringview_data() { operator_pluseq_data(); } void operator_pluseq_qchar() { operator_pluseq_impl<QChar, QString &(QString::*)(QChar)>(); } void operator_pluseq_qchar_data() { operator_pluseq_data(EmptyIsNoop); } void operator_pluseq_qbytearray() { operator_pluseq_impl<QByteArray>(); } |