From d92c9490f9ba24ca703d02ecf3ce75006cca8fdf Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 2 Aug 2012 10:58:07 +1000 Subject: Update docs now that all basic types can also be property types Change-Id: I9f90627dc3f83e64e6d1d7b2937fdf5653a063f3 Reviewed-by: Chris Adams --- src/qml/doc/src/syntax/objectattributes.qdoc | 50 ++++++++++------------------ 1 file changed, 18 insertions(+), 32 deletions(-) (limited to 'src/qml/doc') diff --git a/src/qml/doc/src/syntax/objectattributes.qdoc b/src/qml/doc/src/syntax/objectattributes.qdoc index 741b7cbb91..fa84b79c04 100644 --- a/src/qml/doc/src/syntax/objectattributes.qdoc +++ b/src/qml/doc/src/syntax/objectattributes.qdoc @@ -146,18 +146,26 @@ Rectangle { \section4 Valid Types in Custom Property Definitions -The following types can be used as custom property types: +Any of the \l {QML Basic Types} aside from the \l enumeration type can be used +as custom property types. For example, these are all valid property declarations: -\list -\li \l bool -\li \l int -\li \l real, \l double -\li \l string -\li \l var -\endlist +\qml +Item { + property int someNumber + property string someString + property url someUrl +} +\endqml + +(Enumeration values are simply whole number values and can be referred to with +the \l int type instead.) -The \l var type is a generic placeholder type that can hold any type of value, -including lists and objects: +Some basic types are provided by the \c QtQuick module and thus cannot be used +as property types unless the module is imported. See the \l {QML Basic Types} +documentation for more details. + +Note the \l var basic type is a generic placeholder type that can hold any +type of value, including lists and objects: \code property var someNumber: 1.5 @@ -167,28 +175,6 @@ property var someList: [1, 2, "three", "four"] property var someObject: Rectangle { width: 100; height: 100; color: "red" } \endcode -For convenience, the following types can also be used as custom property types. -Using these types specifically instead of the \l var type provides type safety -and may also assist with application optimization: - -\list -\li \l color -\li \l font -\li \l date -\li \l url -\li \l rect -\li \l point -\li \l size -\li \l vector2d -\li \l vector3d -\li \l vector4d -\li \l quaternion -\li \l matrix4x4 -\endlist - -\note Some of the above types are only available if the Qt Quick module has -been imported by the application. - Additionally, any \l{QML Object Types}{QML object type} can be used as a property type. For example: -- cgit v1.2.3