From 7fea7dfaf3c2a1ee335ef60fd4d7f7803673f3a7 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 29 Apr 2021 18:57:49 +0200 Subject: [PATCH] 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 --- src/corelib/text/qlocale.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index eb180388a15..26087ffd83c 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -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());