diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-07-06 05:30:33 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-07-06 05:30:33 (GMT) |
commit | c9d487b6ed3ac9bb666c2a1fe08252f3c6dcb455 (patch) | |
tree | 68ca42e8c1bbfcf99e6db77be213688d437feeba /doc/src/declarative | |
parent | 6b2ec2ab8df94233d6ba7960d5bfb3c7461b76ec (diff) | |
download | Qt-c9d487b6ed3ac9bb666c2a1fe08252f3c6dcb455.zip Qt-c9d487b6ed3ac9bb666c2a1fe08252f3c6dcb455.tar.gz Qt-c9d487b6ed3ac9bb666c2a1fe08252f3c6dcb455.tar.bz2 |
doc improvements
Diffstat (limited to 'doc/src/declarative')
-rw-r--r-- | doc/src/declarative/extending.qdoc | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 6476dfb..1ee3574 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -684,10 +684,6 @@ of some of the types. For the remaining types the default values are undefined. \row \o color \o #000000 (black) \endtable -If specified, the optional "default" attribute marks the new property as the -types default property, overriding any existing default property. Using the -default attribute twice in the same type block is an error. - The following example shows how to declare a new "innerColor" property that controls the color of the inner rectangle. @@ -705,6 +701,40 @@ controls the color of the inner rectangle. } \endcode + +\section3 Setting default properties + +The optional "default" attribute marks a property as the \e {default property} +for a type. This allows other items to specify the default property's value +as child elements. For example, the \l Item element's default property is its +\l{Item::children}{children} property. This allows the children of an \l Item +to be set like this: + +\qml +Item { + Rectangle {} + Rectangle {} +} +\endqml + +If the \l{Item::children}{children} property was not the default property for +\l Item, its value would have to be set like this instead: + +\qml +Item { + children: [ + Rectangle {} + Rectangle {} + ] +} +\endqml + +Specifying a default property overrides any existing default property (for +example, any default property inherited from a parent item). Using the +default attribute twice in the same type block is an error. + + + \target qml-property-aliases \section2 Property aliases |