summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstring
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-08-05 10:04:11 +0300
committerMarc Mutz <marc.mutz@kdab.com>2016-08-17 08:58:58 +0000
commite6f5a7d6c03366d773dfa29ce4c119d7ab941ac4 (patch)
treefbec4a9d57cd7c7731dc19a59ae7dd8b05ed0e61 /tests/auto/corelib/tools/qstring
parentaf5ccb7f8c91591ef9dec1ccf0ca211962002a94 (diff)
tst_QString: clean up
- add Q_DECLARE_TYPEINFO for types held in Qt containers (incl. QVariant) - port Q_FOREACH to C++11 range-for - port uses of inefficient QLists to QVector Fixes errors pointed out by my tree's static checks. Change-Id: I7176b4b12ed47ed23166857bd127c459ea2a48d5 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/corelib/tools/qstring')
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 36784435b8..2e35c961c6 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -84,11 +84,11 @@ public:
template <typename MemFun>
void apply0(QString &s, MemFun mf) const
- { Q_FOREACH (QChar ch, this->pinned) (s.*mf)(ch); }
+ { for (QChar ch : qAsConst(this->pinned)) (s.*mf)(ch); }
template <typename MemFun, typename A1>
void apply1(QString &s, MemFun mf, A1 a1) const
- { Q_FOREACH (QChar ch, this->pinned) (s.*mf)(a1, ch); }
+ { for (QChar ch : qAsConst(this->pinned)) (s.*mf)(a1, ch); }
};
template <>
@@ -254,6 +254,9 @@ public:
};
} // unnamed namespace
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(CharStarContainer, Q_PRIMITIVE_TYPE);
+QT_END_NAMESPACE
Q_DECLARE_METATYPE(CharStarContainer)
@@ -643,7 +646,7 @@ QString verifyZeroTermination(const QString &str)
} while (0) \
/**/
-typedef QList<int> IntList;
+typedef QVector<int> IntList;
tst_QString::tst_QString()
{