qt6: Handle deprecated QLocale::nativeCountryName

This change ensures compatibility across all supported Qt versions.
This commit is contained in:
Hennadii Stepanov 2024-09-29 12:05:12 +01:00
parent d812cf1189
commit 9123a286e9
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -169,8 +169,15 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
/** check if the locale name consists of 2 parts (language_country) */ /** check if the locale name consists of 2 parts (language_country) */
if(langStr.contains("_")) if(langStr.contains("_"))
{ {
/** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */ /** display language strings as "native language - native country/territory (locale name)", e.g. "Deutsch - Deutschland (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr)); ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") +
#if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
locale.nativeTerritoryName() +
#else
locale.nativeCountryName() +
#endif
QString(" (") + langStr + QString(")"), QVariant(langStr));
} }
else else
{ {