summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale.cpp
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@nokia.com>2011-02-22 14:41:59 (GMT)
committerZeno Albisser <zeno.albisser@nokia.com>2011-02-24 11:42:45 (GMT)
commit3def7f4dd09f5d93f90d20eaedd17d8bd8c4a6fd (patch)
treefd47efebc5b57ba135253fdb06eaf2e3d3024468 /src/corelib/tools/qlocale.cpp
parentc9071e8f9a26dee3a166579df69da11e0f6323fa (diff)
downloadQt-3def7f4dd09f5d93f90d20eaedd17d8bd8c4a6fd.zip
Qt-3def7f4dd09f5d93f90d20eaedd17d8bd8c4a6fd.tar.gz
Qt-3def7f4dd09f5d93f90d20eaedd17d8bd8c4a6fd.tar.bz2
Implemented QLocale::weekendStart and QLocale::weekendEnd
Reviewed-by: Denis Dzyubenko Task-number: QTBUG-17088
Diffstat (limited to 'src/corelib/tools/qlocale.cpp')
-rw-r--r--src/corelib/tools/qlocale.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 61f7b7c..1f8e73c 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -1795,7 +1795,9 @@ QVariant QSystemLocale::query(QueryType /* type */, QVariant /* in */) const
\value MeasurementSystem a QLocale::MeasurementSystem enum specifying the measurement system
\value AMText a string that represents the system AM designator associated with a 12-hour clock.
\value PMText a string that represents the system PM designator associated with a 12-hour clock.
- \value FirstDayOfWeek a Qt::DayOfWeek enum specifiying the first day of the week
+ \value FirstDayOfWeek a Qt::DayOfWeek enum specifying the first day of the week
+ \value WeekendStart a Qt::DayOfWeek enum specifying the first day of the weekend
+ \value WeekendEnd a Qt::DayOfWeek enum specifying the last day of the weekend
\value CurrencySymbol a string that represents a currency in a format QLocale::CurrencyFormat.
\value FormatCurrency a localized string representation of a number with a currency symbol.
\value UILanguages a list of strings representing locale names that could be used for UI translation.
@@ -3941,6 +3943,40 @@ Qt::DayOfWeek QLocale::firstDayOfWeek() const
}
/*!
+ \since 4.8
+
+ Returns the first day of the weekend according to the current locale.
+*/
+Qt::DayOfWeek QLocale::weekendStart() const
+{
+#ifndef QT_NO_SYSTEMLOCALE
+ if (d() == systemPrivate()) {
+ QVariant res = systemLocale()->query(QSystemLocale::WeekendStart, QVariant());
+ if (!res.isNull())
+ return static_cast<Qt::DayOfWeek>(res.toUInt());
+ }
+#endif
+ return static_cast<Qt::DayOfWeek>(d()->m_weekend_start);
+}
+
+/*!
+ \since 4.8
+
+ Returns the last day of the weekend according to the current locale.
+*/
+Qt::DayOfWeek QLocale::weekendEnd() const
+{
+#ifndef QT_NO_SYSTEMLOCALE
+ if (d() == systemPrivate()) {
+ QVariant res = systemLocale()->query(QSystemLocale::WeekendEnd, QVariant());
+ if (!res.isNull())
+ return static_cast<Qt::DayOfWeek>(res.toUInt());
+ }
+#endif
+ return static_cast<Qt::DayOfWeek>(d()->m_weekend_end);
+}
+
+/*!
\since 4.4
Returns the measurement system for the locale.