Restore std::as_const() where a qAsConst was lost between 5.15 and 6

Amends commit 837a29b0b92c72b7b9d66a427c24a9fa8037f4f4's fix for
shadowing to take account of the loss of const-qualification of
uiLanguages where it was then used in a ranged-for loop.

Pick-to: 6.3 6.2
Change-Id: Ic4021bd9917cb27832a197126cc80a7f384a14a2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Edward Welbourne 2021-04-29 18:57:49 +02:00 committed by Marc Mutz
parent 7e82cefb72
commit 7fea7dfaf3

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Copyright (C) 2021 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@ -4458,7 +4458,7 @@ QStringList QLocale::uiLanguages() const
if (d->m_data == &systemLocaleData) {
uiLanguages = systemLocale()->query(QSystemLocale::UILanguages).toStringList();
// ... but we need to include likely-adjusted forms of each of those, too:
for (const auto &entry : uiLanguages)
for (const auto &entry : std::as_const(uiLanguages))
locales.append(QLocale(entry));
if (locales.isEmpty())
locales.append(systemLocale()->fallbackLocale());