diff options
Diffstat (limited to 'doc/src/declarative/basictypes.qdoc')
-rw-r--r-- | doc/src/declarative/basictypes.qdoc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc index c128239b53..98eea78a07 100644 --- a/doc/src/declarative/basictypes.qdoc +++ b/doc/src/declarative/basictypes.qdoc @@ -434,7 +434,8 @@ \brief A var type is a generic property type. A var is a generic property type capable of storing any data type. - It is equivalent to a regular JavaScript variable. + It is equivalent to a regular JavaScript variable, except that you + cannot assign a JavaScript function to such a property. For example, var properties can store numbers, strings, objects and arrays: @@ -449,11 +450,15 @@ property var aPoint: Qt.point(10, 10) property var aSize: Qt.size(10, 10) property var aVector3d: Qt.vector3d(100, 100, 100) - property var anArray: [1, 2, 3, "four", "five"] + property var anArray: [1, 2, 3, "four", "five", (function() { return "six"; })] property var anObject: { "foo": 10, "bar": 20 } } \endqml + Attempting to assign a JavaScript function to a var property will result in + a binding assignment as per other property types. You can assign a JavaScript + array containing a single function element instead. + 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 |