From a1f50456e8c186de56be8562694f663b2bf366a2 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 14 Oct 2023 20:03:37 +0200 Subject: [PATCH] Use `QLocale::territory()` instead of deprecated `QLocale::country()` --- settingsdialog/qtsettings.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/settingsdialog/qtsettings.cpp b/settingsdialog/qtsettings.cpp index 939713e..55fc2a1 100644 --- a/settingsdialog/qtsettings.cpp +++ b/settingsdialog/qtsettings.cpp @@ -532,11 +532,16 @@ QWidget *QtLanguageOptionPage::setupWidget() auto *languageLabel = ui()->languageLabel; QObject::connect(ui()->localeComboBox, &QComboBox::currentTextChanged, languageLabel, [languageLabel, localeComboBox] { - const QLocale selectedLocale(localeComboBox->currentText()); - const QLocale currentLocale; + const auto selectedLocale = QLocale(localeComboBox->currentText()); + const auto currentLocale = QLocale(); + const auto territory = +#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0) + currentLocale.territoryToString(selectedLocale.territory()); +#else + currentLocale.countryToString(selectedLocale.country()); +#endif languageLabel->setText(QCoreApplication::translate("QtGui::QtLanguageOptionPage", "recognized by Qt as") % QStringLiteral(" ") - % currentLocale.languageToString(selectedLocale.language()) % QChar(',') % QChar(' ') - % currentLocale.countryToString(selectedLocale.country()) % QStringLiteral("")); + % currentLocale.languageToString(selectedLocale.language()) % QChar(',') % QChar(' ') % territory % QStringLiteral("")); }); return widget; }