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 <fabian.kosmale@qt.io>
(cherry picked from commit d67aa6291d62300567ae0b99806941eda683fe46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2023-08-07 14:42:55 +02:00 committed by Qt Cherry-pick Bot
parent 6257ade025
commit 539e123f0d

View File

@ -1642,7 +1642,7 @@ class OptionInfo
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
QMap<QWizard::WizardOption, QSharedPointer<Operation> > operations_; QMap<QWizard::WizardOption, QSharedPointer<Operation> > operations_;
foreach (QWizard::WizardOption option, tags.keys()) for (const auto &[option, _] : std::as_const(tags).asKeyValueRange())
operations_[option] = SetOption::create(option, i == 1); operations_[option] = SetOption::create(option, i == 1);
operations << operations_; operations << operations_;
} }