tst_selftests: compile with QT_NO_FOREACH

The loop was iterating over a temporary container, so it couldn't have
changed it. Use a const auto variable to hold the container and port to
ranged-for

Task-number: QTBUG-115839
Change-Id: I66e7cbdb811666ca352cdf064b1228caa346d876
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Ahmad Samir 2023-08-13 18:18:10 +03:00
parent f516cf93b4
commit 890a61fba0
1 changed files with 2 additions and 3 deletions

View File

@ -2,8 +2,6 @@
// Copyright (C) 2016 Intel Corporation.
// 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 <QtCore/QCoreApplication>
QT_REQUIRE_CONFIG(process);
@ -934,7 +932,8 @@ static QProcessEnvironment testEnvironment()
if (environment.isEmpty()) {
const QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment();
const bool preserveLibPath = qEnvironmentVariableIsSet("QT_PRESERVE_TESTLIB_PATH");
foreach (const QString &key, systemEnvironment.keys()) {
const auto envKeys = systemEnvironment.keys();
for (const QString &key : envKeys) {
const bool useVariable = key == "PATH" || key == "QT_QPA_PLATFORM"
#if defined(Q_OS_QNX)
|| key == "GRAPHICS_ROOT" || key == "TZ"