Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
Description
Once property var syntax has been added to QtQuick 2, clients will want to be able to bind to properties of JavaScript objects stored in such var properties. This task is to implement a constructor function on the global Qt object which takes an optional "original object" and produces a JavaScript object whose properties can be bound to.
Previous Work:
- Implementation complete
- Unit tests complete
- Documentation complete
Outstanding Work:
- Performance improvements
- Code review
--------------
Current Status (05/10/2011):
Currently investigating performance trade-offs of various implementation details.
Possible solutions include:
- using Setter + Getter interceptors, storing property values in resource data, notifying manually
- using Setter interceptor plus per-property Get Accessors, storing property values in resource data, notifying manually
- using Setter fallback interceptor plus per-property Get and Set Accessors, storing property values in resource data, notifying manually
- modifying V8 to provide update notification callbacks, and notifying manually (probably out of scope)
Current research shows:
- using per-property Get Accessors improves performance over the interceptor-only solution by an order of magnitude for Get operations, but decreases performance for construction and Set operations (due to cost of installing the accessors on the object). Overall, installing accessors is seen as a much better solution (combined single set+get cost is still lower in the installed-accessor case, and access is hugely more performant).
- passing the propertyIndex as Accessor Data via external pointer allows us to implement deletion, but requires one heap allocation per "original object" property during construction, and one heap allocation during property Set.
- passing the propertyIndex as Accessor Data as an unsigned integer allows a 1% performance increase during construction/set due to avoiding the allocation, but means that we cannot (easily) implement operator delete.
Areas of further research:
- see if a fallback setter interceptor plus Set Accessors can be implemented.
Attachments
Issue Links
- duplicates
-
QTBUG-49984 Altering a JavaScript array (possibly object, too?) without replacing it doesn't appear to emit changed signals
- Closed
-
QTBUG-55996 Qt 5.8 does not re-evaluate bindings in cases that Qt 5.6 did
- Closed
- is duplicated by
-
QTBUG-58282 "model.value.childvalue" value not change in ListModel::delegate
- Closed
- is required for
-
QTBUG-12117 Add support for JS arrays in ListModel
- Open
- relates to
-
QTBUG-79342 Allow binding to members of JavaScript objects and arrays
- Open