Use `QLocale::territory()` instead of deprecated `QLocale::country()`

This commit is contained in:
Martchus 2023-10-14 20:03:37 +02:00
parent d546777f8c
commit a1f50456e8
1 changed files with 9 additions and 4 deletions

View File

@ -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(" <i>")
% currentLocale.languageToString(selectedLocale.language()) % QChar(',') % QChar(' ')
% currentLocale.countryToString(selectedLocale.country()) % QStringLiteral("</i>"));
% currentLocale.languageToString(selectedLocale.language()) % QChar(',') % QChar(' ') % territory % QStringLiteral("</i>"));
});
return widget;
}