diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-05-19 23:10:38 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-06-13 09:40:26 +0200 |
commit | d2ed1074d051c870e7191d0a31f48fae9759e9d7 (patch) | |
tree | 5da6f8ee3e54b4dc93b38880067e657b767fa964 /tests/auto/corelib/global/qlogging/tst_qlogging.cpp | |
parent | 18e7e82d3f23a2a6954308c7a7c49ec23344b593 (diff) |
tests: remove the last uses of Java-style iterators
... except where they are actually the component under test.
Java-style iterators are scheduled for deprecation.
Change-Id: If4399f7f74c5ffc0f7e65205e422edfa1d908ee8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/corelib/global/qlogging/tst_qlogging.cpp')
-rw-r--r-- | tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index f212fe6f27..23507ec2e6 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -870,12 +870,14 @@ void tst_qmessagehandler::setMessagePattern() #endif // make sure there is no QT_MESSAGE_PATTERN in the environment - QStringList environment = m_baseEnvironment; - QMutableListIterator<QString> iter(environment); - while (iter.hasNext()) { - if (iter.next().startsWith("QT_MESSAGE_PATTERN")) - iter.remove(); - } + QStringList environment; + environment.reserve(m_baseEnvironment.size()); + const auto doesNotStartWith = [](QLatin1String s) { + return [s](const QString &str) { return !str.startsWith(s); }; + }; + std::copy_if(m_baseEnvironment.cbegin(), m_baseEnvironment.cend(), + std::back_inserter(environment), + doesNotStartWith(QLatin1String("QT_MESSAGE_PATTERN"))); process.setEnvironment(environment); process.start(appExe); |