Fix regression with country flags.

Since Qt 5.12 QLocale::countryToString returns names of countries with spaces.
This commit is contained in:
Roman Telezhynskyi 2021-02-21 19:39:06 +02:00
parent e9f9fb0f30
commit af1a77f1f1
2 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# Version 0.7.45 (unreleased) # Version 0.7.45 (unreleased)
- Fix incorrect seam allowance for angle type second edge right angle. - Fix incorrect seam allowance for angle type second edge right angle.
- Fix regression with country flags.
# Version 0.7.44 Feb 9, 2021 # Version 0.7.44 Feb 9, 2021
- Placeholder %size% has incorrect value. - Placeholder %size% has incorrect value.

View File

@ -623,7 +623,8 @@ void InitLanguages(QComboBox *combobox)
QLocale loc = QLocale(locale); QLocale loc = QLocale(locale);
QString lang = loc.nativeLanguageName(); QString lang = loc.nativeLanguageName();
QIcon ico(QString("%1/%2.png").arg("://flags", QLocale::countryToString(loc.country()))); // Since Qt 5.12 country names have spaces
QIcon ico(QString("://flags/%1.png").arg(QLocale::countryToString(loc.country()).remove(' ')));
combobox->addItem(ico, lang, locale); combobox->addItem(ico, lang, locale);
} }
@ -631,7 +632,8 @@ void InitLanguages(QComboBox *combobox)
if (combobox->count() == 0 || not englishUS) if (combobox->count() == 0 || not englishUS)
{ {
// English language is internal and doens't have own *.qm file. // English language is internal and doens't have own *.qm file.
QIcon ico(QString("%1/%2.png").arg("://flags", QLocale::countryToString(QLocale::UnitedStates))); // Since Qt 5.12 country names have spaces
QIcon ico(QString("://flags/%1.png").arg(QLocale::countryToString(QLocale::UnitedStates).remove(' ')));
QString lang = QLocale(en_US).nativeLanguageName(); QString lang = QLocale(en_US).nativeLanguageName();
combobox->addItem(ico, lang, en_US); combobox->addItem(ico, lang, en_US);
} }