From 539e123f0d358f9113dff1dc650c8d460a8fc1dd Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 7 Aug 2023 14:42:55 +0200 Subject: [PATCH] tst_QWizard: port away from Q_FOREACH[3/5]: OptionInfo ctor This is iterating over the keys() of a member container we've just filled in the same function. The loop body clearly doesn't modify the container being iterated over. Port to the future-proof ranged for-loop over asKeyValueRange(), using the _-in-SB pattern Christian Ehrlicher showed me to indicate we're not interested in the value. Task-number: QTBUG-115803 Change-Id: I3d86a1de9ea460b7d57fa421ea76e41d2c122f43 Reviewed-by: Fabian Kosmale (cherry picked from commit d67aa6291d62300567ae0b99806941eda683fe46) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index b47321da74e..977d46fbe03 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -1642,7 +1642,7 @@ class OptionInfo for (int i = 0; i < 2; ++i) { QMap > operations_; - foreach (QWizard::WizardOption option, tags.keys()) + for (const auto &[option, _] : std::as_const(tags).asKeyValueRange()) operations_[option] = SetOption::create(option, i == 1); operations << operations_; }