Merge bitcoin-core/gui#838: qt6: Handle deprecated `QLocale::nativeCountryName`

9123a286e9 qt6: Handle deprecated `QLocale::nativeCountryName` (Hennadii Stepanov)

Pull request description:

  Split from https://github.com/bitcoin/bitcoin/pull/30997.

  [`QLocale::nativeCountryName()`](https://doc.qt.io/qt-6/qlocale-obsolete.html#nativeCountryName) has been deprecated since Qt 6.6.

  [`QLocale::nativeTerritoryName()`](https://doc.qt.io/qt-6/qlocale.html#nativeTerritoryName) was introduced in Qt 6.2.

  This PR ensures compatibility across all supported Qt versions.

  No behaviour change for the current codebase, which uses Qt 5.

  ---

  This PR can be tested on macOS using the first commit from https://github.com/bitcoin/bitcoin/pull/30997 and Homebrew's `qt` package.

ACKs for top commit:
  promag:
    Code review ACK 9123a286e9.
  jarolrod:
    ACK 9123a286e9

Tree-SHA512: 937258ab90f41077b0c9b1489e05104e3558b5da522b9dcd07fe373826aa671b2388539425f38c43fcde22419cdb8694cdcb04574d92b773acdb80f9a4fb1c02
pull/31031/head
Hennadii Stepanov 1 month ago
commit f117f3f747
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

@ -166,8 +166,15 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
/** check if the locale name consists of 2 parts (language_country) */
if(langStr.contains("_"))
{
/** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
/** display language strings as "native language - native country/territory (locale name)", e.g. "Deutsch - Deutschland (de)" */
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
{

Loading…
Cancel
Save