summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qstringlist.cpp10
-rw-r--r--src/corelib/tools/qstringlist.h2
-rw-r--r--tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp5
3 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index 3f63b3b8e7..a7379b144c 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -478,6 +478,16 @@ QString QtPrivate::QStringList_join(const QStringList *that, const QChar *sep, i
the latter string list.
*/
+/*!
+ \fn QStringList &QStringList::operator<<(const QList<QString> &other)
+ \since 5.4
+
+ \overload
+
+ Appends the \a other string list to the string list and returns a reference to
+ the latter string list.
+*/
+
#ifndef QT_NO_DATASTREAM
/*!
\fn QDataStream &operator>>(QDataStream &in, QStringList &list)
diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h
index 11a4d87890..1cdafb4ec2 100644
--- a/src/corelib/tools/qstringlist.h
+++ b/src/corelib/tools/qstringlist.h
@@ -85,6 +85,8 @@ public:
{ append(str); return *this; }
inline QStringList &operator<<(const QStringList &l)
{ *this += l; return *this; }
+ inline QStringList &operator<<(const QList<QString> &l)
+ { *this += l; return *this; }
#ifndef QT_NO_REGEXP
inline QStringList filter(const QRegExp &rx) const;
diff --git a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
index 246560e47f..a9ddb6844e 100644
--- a/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
+++ b/tests/auto/corelib/tools/qstringlist/tst_qstringlist.cpp
@@ -321,8 +321,13 @@ void tst_QStringList::streamingOperator()
list << "hei";
list << list << "hopp" << list;
+ QList<QString> slist = list;
+ list << slist;
+
QCOMPARE(list, QStringList()
<< "hei" << "hei" << "hopp"
+ << "hei" << "hei" << "hopp"
+ << "hei" << "hei" << "hopp"
<< "hei" << "hei" << "hopp");
QStringList list2;