Fix regression with country flags.

Since Qt 5.12 QLocale::countryToString returns names of countries with spaces.

(cherry picked from commit af1a77f1f1)
This commit is contained in:
Roman Telezhynskyi 2021-02-24 14:49:58 +02:00
parent 359735f034
commit 5128669d0b
2 changed files with 5 additions and 2 deletions

View File

@ -41,6 +41,7 @@
- Fix crash while synchronize measurements.
- Fix incorrect filename regular expressions.
- Enabling Show Curve Details option causes constant redraw.
- Fix regression with country flags.
# Version 0.6.1 October 23, 2018
- [#885] Regression. Broken support for multi size measurements.

View File

@ -825,7 +825,8 @@ void InitLanguages(QComboBox *combobox)
QLocale loc = QLocale(locale);
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);
}
@ -833,7 +834,8 @@ void InitLanguages(QComboBox *combobox)
if (combobox->count() == 0 || not englishUS)
{
// 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();
combobox->addItem(ico, lang, en_US);
}