aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/doc/src/cppintegration/contextproperties.qdoc14
-rw-r--r--src/qml/doc/src/javascript/date.qdoc106
-rw-r--r--src/qml/doc/src/javascript/number.qdoc2
-rw-r--r--src/qml/qml/qqmllocale.cpp58
4 files changed, 137 insertions, 43 deletions
diff --git a/src/qml/doc/src/cppintegration/contextproperties.qdoc b/src/qml/doc/src/cppintegration/contextproperties.qdoc
index 1c2bced738..e0d5091f2f 100644
--- a/src/qml/doc/src/cppintegration/contextproperties.qdoc
+++ b/src/qml/doc/src/cppintegration/contextproperties.qdoc
@@ -84,11 +84,15 @@ a \l Connections object:
\snippet qml/qtbinding/context-advanced/connections.qml 0
Context properties can be useful for using C++ based data models in a QML view. See the
-\l {quick/modelviews/stringlistmodel}{String ListModel},
-\l {quick/modelviews/objectlistmodel}{Object ListModel} and
-\l {quick/modelviews/abstractitemmodel}{AbstractItemModel} models for
-respective examples on using QStringListModel, QObjectList-based models and QAbstractItemModel
-in QML views.
+following examples:
+\list
+ \li \l {Models and Views: String ListModel Example}{String ListModel}
+ \li \l {Models and Views: Object ListModel Example}{Object ListModel}
+ \li \l {Models and Views: AbstractItemModel Example}{AbstractItemModel}
+\endlist
+
+demonstrating the use of QStringList, \l{QList<QObject*>}-based models and
+QAbstractItemModel in QML views.
Also see the QQmlContext documentation for more information.
diff --git a/src/qml/doc/src/javascript/date.qdoc b/src/qml/doc/src/javascript/date.qdoc
index 085d988377..89dc464adb 100644
--- a/src/qml/doc/src/javascript/date.qdoc
+++ b/src/qml/doc/src/javascript/date.qdoc
@@ -132,17 +132,18 @@
hour, if DST is currently in effect, while it was not for the time specified, or
vice versa.
- \sa {QtQuick2::Locale}{Locale}
+ \sa {QtQml2::Locale}{Locale}
*/
/*!
- \qmlmethod string Date::toLocaleString(locale,format)
+ \qmlmethod string Date::toLocaleString(locale, format)
Converts the Date to a string containing the date and time
suitable for the specified \a locale
in the specified \a format.
- If the format is not specified Locale.LongFormat will be used.
+ If \a format is not specified, \l {QtQml2::Locale}{Locale.LongFormat} will
+ be used.
If \a locale is not specified, the default locale will be used.
@@ -158,12 +159,13 @@
*/
/*!
- \qmlmethod string Date::toLocaleDateString(locale,format)
+ \qmlmethod string Date::toLocaleDateString(locale, format)
Converts the Date to a string containing the date suitable for the specified \a locale
in the specified \a format.
- If the format is not specified Locale.LongFormat will be used.
+ If \a format is not specified, \l {QtQml2::Locale}{Locale.LongFormat} will
+ be used.
If \a locale is not specified, the default locale will be used.
@@ -179,12 +181,13 @@
*/
/*!
- \qmlmethod string Date::toLocaleTimeString(locale,format)
+ \qmlmethod string Date::toLocaleTimeString(locale, format)
Converts the Date to a string containing the time suitable for the specified \a locale
in the specified \a format.
- If the format is not specified Locale.LongFormat will be used.
+ If \a format is not specified, \l {QtQml2::Locale}{Locale.LongFormat} will
+ be used.
If \a locale is not specified, the default locale will be used.
@@ -200,10 +203,97 @@
*/
/*!
+ \qmlmethod string Date::fromLocaleString(locale, dateTimeString, format)
+
+ Converts the datetime string \a dateTimeString to a \l {QtQml2::Date}{Date}
+ object using \a locale and \a format.
+
+ If \a format is not specified, \l {QtQml2::Locale}{Locale.LongFormat} will
+ be used.
+
+ If \a locale is not specified, the default locale will be used.
+
+ The following example shows a datetime being parsed from a datetime string
+ in a certain format using the default locale:
+ \code
+ import QtQml 2.0
+
+ QtObject {
+ property var locale: Qt.locale()
+ property string dateTimeString: "Tue 2013-09-17 10:56:06"
+
+ Component.onCompleted: {
+ print(Date.fromLocaleString(locale, dateTimeString, "ddd yyyy-MM-dd hh:mm:ss"));
+ }
+ }
+ \endcode
+*/
+
+/*!
+ \qmlmethod string Date::fromLocaleDateString(locale, dateString, format)
+
+ Converts the date string \a dateString to a \l {QtQml2::Date}{Date} object
+ using \a locale and \a format.
+
+ If \a format is not specified, \l {QtQml2::Locale}{Locale.LongFormat} will
+ be used.
+
+ If \a locale is not specified, the default locale will be used.
+
+ The following example shows the current date first being formatted as a date
+ string using the default locale and format, then parsed back again in the
+ same manner:
+ \code
+ import QtQml 2.0
+
+ QtObject {
+ property var locale: Qt.locale()
+ property date currentDate: new Date()
+ property string dateString
+
+ Component.onCompleted: {
+ dateString = currentDate.toLocaleDateString();
+ print(Date.fromLocaleDateString(dateString));
+ }
+ }
+ \endcode
+*/
+
+/*!
+ \qmlmethod string Date::fromLocaleTimeString(locale, timeString, format)
+
+ Converts the time string \a timeString to a \l {QtQml2::Date}{Date} object
+ using \a locale and \a format.
+
+ If \a format is not specified, \l {QtQml2::Locale}{Locale.LongFormat} will
+ be used.
+
+ If \a locale is not specified, the default locale will be used.
+
+ The following example shows the current time first being formatted as a time
+ string using the default locale and a short format, then parsed back again
+ in the same manner:
+ \code
+ import QtQuick 2.0
+
+ QtObject {
+ property var locale: Qt.locale()
+ property date currentTime: new Date()
+ property string timeString
+
+ Component.onCompleted: {
+ timeString = currentTime.toLocaleTimeString(locale, Locale.ShortFormat);
+ print(Date.fromLocaleTimeString(locale, timeString, Locale.ShortFormat));
+ }
+ }
+ \endcode
+*/
+
+/*!
\qmlmethod string Date::timeZoneUpdated()
Informs the JS engine that the system's timezone has been changed, which is necessary
- for the correct manipulation of date/time data.
+ for the correct manipulation of datetime data.
JS stores Date objects in UTC time; all access to and from Date components in local
time involves the application of the current offset from UTC. If the current offset
diff --git a/src/qml/doc/src/javascript/number.qdoc b/src/qml/doc/src/javascript/number.qdoc
index 20fe40c86f..fa56f71925 100644
--- a/src/qml/doc/src/javascript/number.qdoc
+++ b/src/qml/doc/src/javascript/number.qdoc
@@ -33,7 +33,7 @@
The QML Number object extends the JS Number object with
locale aware functions.
- \sa {QtQuick2::Locale}{Locale}
+ \sa {QtQml2::Locale}{Locale}
*/
/*!
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 5e7116e271..405411e65c 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -798,7 +798,7 @@ V8_DEFINE_EXTENSION(QV8LocaleDataDeletable, localeV8Data);
This product includes software developed by the University of
California, Berkeley and its contributors.
- \sa {QtQuick2::Date}{Date}, {QtQuick2::Number}{Number}
+ \sa Date, Number
*/
QQmlLocale::QQmlLocale()
@@ -840,7 +840,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
}
/*!
- \qmlproperty string QtQuick2::Locale::name
+ \qmlproperty string QtQml2::Locale::name
Holds the language and country of this locale as a
string of the form "language_country", where
@@ -849,77 +849,77 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlproperty string QtQuick2::Locale::decimalPoint
+ \qmlproperty string QtQml2::Locale::decimalPoint
Holds the decimal point character of this locale.
*/
/*!
- \qmlproperty string QtQuick2::Locale::groupSeparator
+ \qmlproperty string QtQml2::Locale::groupSeparator
Holds the group separator character of this locale.
*/
/*!
- \qmlproperty string QtQuick2::Locale::percent
+ \qmlproperty string QtQml2::Locale::percent
Holds the percent character of this locale.
*/
/*!
- \qmlproperty string QtQuick2::Locale::zeroDigit
+ \qmlproperty string QtQml2::Locale::zeroDigit
Holds Returns the zero digit character of this locale.
*/
/*!
- \qmlproperty string QtQuick2::Locale::negativeSign
+ \qmlproperty string QtQml2::Locale::negativeSign
Holds the negative sign character of this locale.
*/
/*!
- \qmlproperty string QtQuick2::Locale::positiveSign
+ \qmlproperty string QtQml2::Locale::positiveSign
Holds the positive sign character of this locale.
*/
/*!
- \qmlproperty string QtQuick2::Locale::exponential
+ \qmlproperty string QtQml2::Locale::exponential
Holds the exponential character of this locale.
*/
/*!
- \qmlmethod string QtQuick2::Locale::dateTimeFormat(type)
+ \qmlmethod string QtQml2::Locale::dateTimeFormat(type)
Returns the date time format used for the current locale.
\a type specifies the FormatType to return.
- \sa {QtQuick2::Date}{Date}
+ \sa Date
*/
/*!
- \qmlmethod string QtQuick2::Locale::dateFormat(type)
+ \qmlmethod string QtQml2::Locale::dateFormat(type)
Returns the date format used for the current locale.
\a type specifies the FormatType to return.
- \sa {QtQuick2::Date}{Date}
+ \sa Date
*/
/*!
- \qmlmethod string QtQuick2::Locale::timeFormat(type)
+ \qmlmethod string QtQml2::Locale::timeFormat(type)
Returns the time format used for the current locale.
\a type specifies the FormatType to return.
- \sa {QtQuick2::Date}{Date}
+ \sa Date
*/
/*!
- \qmlmethod string QtQuick2::Locale::monthName(month, type)
+ \qmlmethod string QtQml2::Locale::monthName(month, type)
Returns the localized name of \a month (0-11), in the optional
\l FormatType specified by \a type.
@@ -931,7 +931,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlmethod string QtQuick2::Locale::standaloneMonthName(month, type)
+ \qmlmethod string QtQml2::Locale::standaloneMonthName(month, type)
Returns the localized name of \a month (0-11) that is used as a
standalone text, in the optional \l FormatType specified by \a type.
@@ -946,7 +946,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlmethod string QtQuick2::Locale::dayName(day, type)
+ \qmlmethod string QtQml2::Locale::dayName(day, type)
Returns the localized name of the \a day (where 0 represents
Sunday, 1 represents Monday and so on), in the optional
@@ -956,7 +956,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlmethod string QtQuick2::Locale::standaloneDayName(day, type)
+ \qmlmethod string QtQml2::Locale::standaloneDayName(day, type)
Returns the localized name of the \a day (where 0 represents
Sunday, 1 represents Monday and so on) that is used as a
@@ -969,7 +969,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlproperty enumeration QtQuick2::Locale::firstDayOfWeek
+ \qmlproperty enumeration QtQml2::Locale::firstDayOfWeek
Holds the first day of the week according to the current locale.
@@ -988,7 +988,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlproperty Array<int> QtQuick2::Locale::weekDays
+ \qmlproperty Array<int> QtQml2::Locale::weekDays
Holds an array of days that are considered week days according to the current locale,
where Sunday is 0 and Saturday is 6.
@@ -997,7 +997,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlproperty Array<string> QtQuick2::Locale::uiLanguages
+ \qmlproperty Array<string> QtQml2::Locale::uiLanguages
Returns an ordered list of locale names for translation purposes in
preference order.
@@ -1009,7 +1009,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlproperty enumeration QtQuick2::Locale::textDirection
+ \qmlproperty enumeration QtQml2::Locale::textDirection
Holds the text direction of the language:
\list
@@ -1019,19 +1019,19 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlproperty string QtQuick2::Locale::amText
+ \qmlproperty string QtQml2::Locale::amText
The localized name of the "AM" suffix for times specified using the conventions of the 12-hour clock.
*/
/*!
- \qmlproperty string QtQuick2::Locale::pmText
+ \qmlproperty string QtQml2::Locale::pmText
The localized name of the "PM" suffix for times specified using the conventions of the 12-hour clock.
*/
/*!
- \qmlmethod string QtQuick2::Locale::currencySymbol(format)
+ \qmlmethod string QtQml2::Locale::currencySymbol(format)
Returns the currency symbol for the specified \a format:
\list
@@ -1043,7 +1043,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlproperty string QtQuick2::Locale::nativeLanguageName
+ \qmlproperty string QtQml2::Locale::nativeLanguageName
Holds a native name of the language for the locale. For example
"Schwiizertüütsch" for Swiss-German locale.
@@ -1052,7 +1052,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlproperty string QtQuick2::Locale::nativeCountryName
+ \qmlproperty string QtQml2::Locale::nativeCountryName
Holds a native name of the country for the locale. For example
"España" for Spanish/Spain locale.
@@ -1061,7 +1061,7 @@ QV4::ReturnedValue QQmlLocale::method_localeCompare(QV4::SimpleCallContext *ctx)
*/
/*!
- \qmlproperty enumeration QtQuick2::Locale::measurementSystem
+ \qmlproperty enumeration QtQml2::Locale::measurementSystem
This property defines which units are used for measurement.