Skip to content

Commit 10be1c4

Browse files
committed
qt6: Handle deprecated QLocale::nativeCountryName
This change ensures compatibility across all supported Qt versions.
1 parent d812cf1 commit 10be1c4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/qt/optionsdialog.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,15 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
169169
/** check if the locale name consists of 2 parts (language_country) */
170170
if(langStr.contains("_"))
171171
{
172-
/** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
173-
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
172+
/** display language strings as "native language - native country/territory (locale name)", e.g. "Deutsch - Deutschland (de)" */
173+
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") +
174+
#if (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
175+
locale.nativeTerritoryName() +
176+
#else
177+
locale.nativeCountryName() +
178+
#endif
179+
QString(" (") + langStr + QString(")"), QVariant(langStr));
180+
174181
}
175182
else
176183
{

0 commit comments

Comments
 (0)