diff options
Diffstat (limited to 'examples/widgets/widgets/calendarwidget')
-rw-r--r-- | examples/widgets/widgets/calendarwidget/window.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/widgets/widgets/calendarwidget/window.cpp b/examples/widgets/widgets/calendarwidget/window.cpp index e88e41beb2..38e9798d83 100644 --- a/examples/widgets/widgets/calendarwidget/window.cpp +++ b/examples/widgets/widgets/calendarwidget/window.cpp @@ -237,6 +237,9 @@ void Window::createPreviewGroupBox() } //! [9] +// TODO: use loc.name() as label (but has underscore in place of slash) +// TODO: use locale() == loc instead of only comparing language and territory +// Needs someone familiar with this example to work out ramifications //! [10] void Window::createGeneralOptionsGroupBox() { @@ -247,15 +250,16 @@ void Window::createGeneralOptionsGroupBox() int index = 0; for (int _lang = QLocale::C; _lang <= QLocale::LastLanguage; ++_lang) { QLocale::Language lang = static_cast<QLocale::Language>(_lang); - const auto territories = QLocale::territoriesForLanguage(lang); - for (auto territory : territories) { + const auto locales = + QLocale::matchingLocales(lang, QLocale::AnyScript, QLocale::AnyTerritory); + for (auto loc : locales) { QString label = QLocale::languageToString(lang); + auto territory = loc.territory(); label += QLatin1Char('/'); label += QLocale::territoryToString(territory); - QLocale locale(lang, territory); - if (this->locale().language() == lang && this->locale().territory() == territory) + if (locale().language() == lang && locale().territory() == territory) curLocaleIndex = index; - localeCombo->addItem(label, locale); + localeCombo->addItem(label, loc); ++index; } } |