diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-08-11 03:09:40 +0300 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-08-19 16:29:09 +0300 |
commit | e7b07b64c7b0536eccba6ff25e23badb88226813 (patch) | |
tree | d70ab6c7451f2e6b62887684fe3ab528d345a577 /tests/auto/corelib/io/qfileselector | |
parent | c7a8e1e9928fc2b84e6179adc69c858b17b25d48 (diff) |
tests/auto/*: port Q_FOREACH to ranged-for
The loop was iterating over a temporary container, so it couldn't have
changed it. Store the container in a const auto variable and use
ranged-for.
In files where Q_FOREACH isn't used any more, remove
"#undef QT_NO_FOREACH".
Task-number: QTBUG-115839
Change-Id: I402df5fa48f4287f3cc989ddae1524da43999049
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qfileselector')
-rw-r--r-- | tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp index 3c17b6eb57..34d9076ff7 100644 --- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp +++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp @@ -1,8 +1,6 @@ // Copyright (C) 2013 BlackBerry Limited. All rights reserved. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses - #include <QTest> #include <qplatformdefs.h> @@ -76,7 +74,8 @@ void tst_QFileSelector::basicTest_data() # if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)) || defined(Q_OS_FREEBSD) distributionName = QSysInfo::productType(); # endif - foreach (const QString &selector, QFileSelectorPrivate::platformSelectors()) { + const auto platformSelectors = QFileSelectorPrivate::platformSelectors(); + for (const QString &selector : platformSelectors) { // skip the Linux distribution name (if any) since we don't have files for them if (selector == distributionName) continue; |