aboutsummaryrefslogtreecommitdiff
path: root/src/corelib/i18n/mlocale.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/i18n/mlocale.cpp')
-rw-r--r--src/corelib/i18n/mlocale.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/corelib/i18n/mlocale.cpp b/src/corelib/i18n/mlocale.cpp
index 1b842b93..9576bad4 100644
--- a/src/corelib/i18n/mlocale.cpp
+++ b/src/corelib/i18n/mlocale.cpp
@@ -277,7 +277,7 @@ icu::DateFormatSymbols *MLocalePrivate::createDateFormatSymbols(const icu::Local
#endif
#ifdef HAVE_ICU
-static bool isTwelveHours(const QString &icuFormatQString)
+bool MLocalePrivate::isTwelveHours(const QString &icuFormatQString) const
{
if (icuFormatQString.contains('\'')) {
bool isQuoted = false;
@@ -1460,6 +1460,21 @@ MLocale::TimeFormat24h MLocale::timeFormat24h() const
}
#ifdef HAVE_ICU
+MLocale::TimeFormat24h MLocale::defaultTimeFormat24h() const
+{
+ Q_D(const MLocale);
+ QString defaultTimeShortFormat
+ = d->icuFormatString(MLocale::DateNone, MLocale::TimeShort,
+ d->_calendarType,
+ MLocale::LocaleDefaultTimeFormat24h);
+ if (d->isTwelveHours(defaultTimeShortFormat))
+ return MLocale::TwelveHourTimeFormat24h;
+ else
+ return MLocale::TwentyFourHourTimeFormat24h;
+}
+#endif
+
+#ifdef HAVE_ICU
MCollator MLocale::collator() const
{
return MCollator(*this);