From 5128669d0b8834bfc89ff50461c656fca2b2176a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 24 Feb 2021 14:49:58 +0200 Subject: [PATCH] Fix regression with country flags. Since Qt 5.12 QLocale::countryToString returns names of countries with spaces. (cherry picked from commit af1a77f1f1488d8d3f7cf8d2e550341712001884) --- ChangeLog.txt | 1 + src/libs/vmisc/def.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index ac2913b12..b38e39d7f 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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. diff --git a/src/libs/vmisc/def.cpp b/src/libs/vmisc/def.cpp index 759f44d5a..0be5f30e4 100644 --- a/src/libs/vmisc/def.cpp +++ b/src/libs/vmisc/def.cpp @@ -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); }