aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2012-01-20 09:24:56 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-20 09:13:38 +0100
commit126ada14b21f62d9349756cc6a3ef835d40a3e7d (patch)
tree9ebb6ed483e1ee630a413eb6142b1a48682fbfee
parent16e823580b4ed14000d1f75ac2da16c432a8986f (diff)
Doc: Improve Qt.locale docs.
Change-Id: I3ef5c4a0bedbaa346b001852bba8e9ff9347e9e0 Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
-rw-r--r--doc/src/declarative/qmldate.qdoc49
-rw-r--r--src/declarative/qml/qdeclarativelocale.cpp4
2 files changed, 47 insertions, 6 deletions
diff --git a/doc/src/declarative/qmldate.qdoc b/doc/src/declarative/qmldate.qdoc
index 74b3a7a3c7..82154e7424 100644
--- a/doc/src/declarative/qmldate.qdoc
+++ b/doc/src/declarative/qmldate.qdoc
@@ -36,16 +36,16 @@
Functions that accept a locale format may be either an enumeration
value:
\table
- \row \i Locale.LongFormat \i The long version of day and month names; for example, returning "January" as a month name.
- \row \i Locale.ShortFormat \i The short version of day and month names; for example, returning "Jan" as a month name.
- \row \i Locale.NarrowFormat \i A special version of day and month names for use when space is limited;
+ \row \i Locale.LongFormat \i The long version of the string; for example, returning "January" as a month name.
+ \row \i Locale.ShortFormat \i The short version of the string; for example, returning "Jan" as a month name.
+ \row \i Locale.NarrowFormat \i A special version for use when space is limited;
for example, returning "J" as a month name. Note that the narrow format might contain
the same text for different months and days or it can even be an empty string if the
locale doesn't support narrow names, so you should avoid using it for date formatting.
Also, for the system locale this format is the same as ShortFormat.
\endtable
- or a string specifying the format:
+ or a string specifying the format These expressions may be used for format dates:
\table
\header \i Expression \i Output
\row \i d \i the day as number without a leading zero (1 to 31)
@@ -80,6 +80,47 @@
\row \o 'The day is' dddd \o The day is Sunday
\endtable
+ These expressions may be used for formatting time:
+
+ \table
+ \header \i Expression \i Output
+ \row \i h
+ \i the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)
+ \row \i hh
+ \i the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
+ \row \i H
+ \i the hour without a leading zero (0 to 23, even with AM/PM display)
+ \row \i HH
+ \i the hour with a leading zero (00 to 23, even with AM/PM display)
+ \row \i m \i the minute without a leading zero (0 to 59)
+ \row \i mm \i the minute with a leading zero (00 to 59)
+ \row \i s \i the second without a leading zero (0 to 59)
+ \row \i ss \i the second with a leading zero (00 to 59)
+ \row \i z \i the milliseconds without leading zeroes (0 to 999)
+ \row \i zzz \i the milliseconds with leading zeroes (000 to 999)
+ \row \i AP or A
+ \i use AM/PM display. \e AP will be replaced by either "AM" or "PM".
+ \row \i ap or a
+ \i use am/pm display. \e ap will be replaced by either "am" or "pm".
+ \row \i t \i the timezone (for example "CEST")
+ \endtable
+
+ All other input characters will be ignored. Any sequence of characters that
+ are enclosed in singlequotes will be treated as text and not be used as an
+ expression. Two consecutive singlequotes ("''") are replaced by a singlequote
+ in the output.
+
+ Example format strings (assuming that the QTime is 14:13:09.042)
+
+ \table
+ \header \i Format \i Result
+ \row \i hh:mm:ss.zzz \i 14:13:09.042
+ \row \i h:m:s ap \i 2:13:9 pm
+ \row \i H:m:s a \i 14:13:9 pm
+ \endtable
+
+ If the date is invalid, an empty string will be returned.
+
\sa {QtQuick2::Locale}{Locale}
*/
diff --git a/src/declarative/qml/qdeclarativelocale.cpp b/src/declarative/qml/qdeclarativelocale.cpp
index 88259c5dbf..44e47058c6 100644
--- a/src/declarative/qml/qdeclarativelocale.cpp
+++ b/src/declarative/qml/qdeclarativelocale.cpp
@@ -990,9 +990,9 @@ v8::Handle<v8::Value> QDeclarativeLocale::locale(QV8Engine *v8engine, const QStr
*/
/*!
- \qmlproperty Array<int> QtQuick2::Locale::weekdays
+ \qmlproperty Array<int> QtQuick2::Locale::weekDays
- Holds an array of days that are considered weekdays according to the current locale,
+ Holds an array of days that are considered week days according to the current locale,
where Sunday is 0 and Saturday is 6.
\sa firstDayOfWeek