aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlcomponent
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-02-06 14:24:42 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-05 09:01:47 +0100
commitb6e78b38367a23f0b053bbd2abe4ef161e4053b9 (patch)
tree022bb82553af5b96a31f6e1ba56944d0e7060437 /tests/auto/qml/qqmlcomponent
parent0284817d6cd7e17afa8da26ee6e9199100754446 (diff)
Improve support for var properties
This commit changes the semantics of function assignment in QML. Previously, function assignment was interpreted as binding assignment. Now, function assignment is interpreted as function assignment, and therefore fails for all property types other than "var" properties. To support imperative binding assignment, a new function was added to the Qt object: Qt.binding(function) which takes a single function parameter and returns a function object which will be interpreted as an assignable binding expression by the QML engine. Finally, this commit also slightly changes the semantics of var properties in that the "special" JavaScript values of null and undefined may be assigned to var properties, rather than being interpreted as reset requests. Task-number: QTBUG-21842 Change-Id: Iee99a878b9badf0fb76e983da7ebfa493f55ceb5 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlcomponent')
-rw-r--r--tests/auto/qml/qqmlcomponent/data/createObjectWithScript.qml4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmlcomponent/data/createObjectWithScript.qml b/tests/auto/qml/qqmlcomponent/data/createObjectWithScript.qml
index 122c6a87c8..989b295cb5 100644
--- a/tests/auto/qml/qqmlcomponent/data/createObjectWithScript.qml
+++ b/tests/auto/qml/qqmlcomponent/data/createObjectWithScript.qml
@@ -37,7 +37,7 @@ Item{
root.declarativerectangle = a.createObject(root, {"x":17,"y":17, "color":"white", "border.width":3, "innerRect.border.width": 20});
root.declarativeitem = b.createObject(root, {"x":17,"y":17,"testBool":true,"testInt":17,"testObject":root});
- root.bindingTestObject = c.createObject(root, {'testValue': (function(){return width * 3}) }) // use root.width
- root.bindingThisTestObject = c.createObject(root, {'testValue': (function(){return this.width * 3}) }) // use width of Item within 'c'
+ root.bindingTestObject = c.createObject(root, {'testValue': Qt.binding(function(){return width * 3}) }) // use root.width
+ root.bindingThisTestObject = c.createObject(root, {'testValue': Qt.binding(function(){return this.width * 3}) }) // use width of Item within 'c'
}
}