diff options
author | Chris Adams <christopher.adams@nokia.com> | 2011-11-01 16:54:47 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-04 05:29:17 +0100 |
commit | f9d897b03cd6919bbac1205fc90a09354b31f286 (patch) | |
tree | 7734b95eeac08a2bba9ba194740b41266fde6e8c /doc | |
parent | fb21b2bdde09b2cb49316073ac47518245b6d481 (diff) |
Fix documentation for property var
Previously, it was not clear that a binding which accesses a property
of a JavaScript Objects assigned to a var property would not be
re-evaluated if the value of the property changed.
Change-Id: I72d990e05104bc452fc516511a14716b2913ff9a
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/declarative/basictypes.qdoc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index 1bc13739fa..5e4ce9aedd 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -449,21 +449,22 @@ } \endqml - It is important to note that properties of JavaScript objects cannot - be bound to: + It is important to note that changes in regular properties of JavaScript + objects assigned to a var property will \bold{not} trigger updates of bindings + that access them. The example below will display "The car has 4 wheels" as + the change to the wheels property will not cause the reevaluation of the + binding assigned to the "text" property: \qml Item { - property var car: new vehicle(4) - property int wheelCount: car.wheels + property var car: new Object({wheels: 4}) - function vehicle(wheels) { - this.wheels = wheels; - this.talk = function() { print("I have " + this.wheels + " wheels!"); } + Text { + text: "The car has " + car.wheels + " wheels"; } Component.onCompleted: { - car.wheels = 6; // wheelCount will _not_ be updated + car.wheels = 6; } } \endqml |