On 01/27/2012 12:45 AM, [email protected] wrote:
> Hi Harri,
>
>
> In short, the behavior you are seeing is expected.
>
> However, for QtQuick2.0, we are looking at ways to allow a function value to 
> be saved to a "var" property (or perhaps to a new property type).  We are 
> currently considering several options:
>
> 1) adding a new property type: "property function someProp" to which js 
> function values can be assigned
> 2) adding a new function to the Qt global object: 
> Qt.assignableFunction("expr") -- if the result is assigned to a var property, 
> it is NOT considered a binding assignment
> 3) changing the semantic so that a function assignment is NOT considered to 
> be a binding assignment, and instead adding a new function to the Qt global 
> object: Qt.binding("expr") -- if the result is assigned to any property, it 
> is evaluated as a binding assignment.
>
> Note that we do need some way to define binding assignments (eg for initial 
> property values in dynamic object instantiation (loader, component), and for 
> generating bindings in imperative js code), but as you point out, there are 
> some good use-cases for being able to assign a js function value to a var 
> property.

Thanks for the explanation, makes sense.

Of the 3 alternatives I prefer the first one on style grounds.
2 & 3 sound "hacky", if the Qt.xxx is elsewhere in
code it is not obvious for someone reading the code that it
even exists.

Changing the semantics of assignment elsewhere
in code sounds odd.  Probably less odd for C++ users
for whom it is more common, but the target developer
is probably not him.

Harri


_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to