Improve support for var properties
authorChris Adams <christopher.adams@nokia.com>
Mon, 6 Feb 2012 04:24:42 +0000 (14:24 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 5 Mar 2012 08:01:47 +0000 (09:01 +0100)
commitb6e78b38367a23f0b053bbd2abe4ef161e4053b9
tree022bb82553af5b96a31f6e1ba56944d0e7060437
parent0284817d6cd7e17afa8da26ee6e9199100754446
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>
30 files changed:
doc/src/qml/basictypes.qdoc
doc/src/qml/javascriptblocks.qdoc
doc/src/qml/propertybinding.qdoc
doc/src/snippets/qml/DynamicText.qml [new file with mode: 0644]
doc/src/snippets/qml/qtBinding.1.qml [new file with mode: 0644]
doc/src/snippets/qml/qtBinding.2.qml [new file with mode: 0644]
doc/src/snippets/qml/qtBinding.3.qml [new file with mode: 0644]
doc/src/snippets/qml/qtBinding.4.qml [new file with mode: 0644]
src/qml/qml/qqmlproperty.cpp
src/qml/qml/v8/qqmlbuiltinfunctions.cpp
src/qml/qml/v8/qqmlbuiltinfunctions_p.h
src/qml/qml/v8/qv8engine.cpp
src/qml/qml/v8/qv8engine_p.h
src/qml/qml/v8/qv8qobjectwrapper.cpp
src/qml/qml/v8/qv8valuetypewrapper.cpp
tests/auto/qml/qqmlcomponent/data/createObjectWithScript.qml
tests/auto/qml/qqmlecmascript/data/functionAssignment.1.qml
tests/auto/qml/qqmlecmascript/data/functionAssignment.2.qml
tests/auto/qml/qqmlecmascript/data/functionAssignment.3.qml [new file with mode: 0644]
tests/auto/qml/qqmlecmascript/data/functionAssignment.js
tests/auto/qml/qqmlecmascript/data/propertyVar.11.qml [new file with mode: 0644]
tests/auto/qml/qqmlecmascript/data/propertyVar.12.qml [new file with mode: 0644]
tests/auto/qml/qqmlecmascript/data/propertyVar.13.qml [new file with mode: 0644]
tests/auto/qml/qqmlecmascript/data/propertyVar.14.qml [new file with mode: 0644]
tests/auto/qml/qqmlecmascript/data/propertyVar.15.qml [new file with mode: 0644]
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.2.qml [new file with mode: 0644]
tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.qml
tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
tests/auto/quick/qquickloader/data/initialPropertyValues.binding.qml