Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
Description
Due to the dual object/value nature of value types and lists, manipulating properties of such types incurs too many copies and detaches. Furthermore, it is hard to grasp when the value:
- logically detaches producing two copies that can be observably different.
- technically detaches, producing two copies that are synced via the value type and list reference mechanism.
One tool that might be applied here is a C++-based value type or list reference as extra attribute to Q_PROPERTY. Specifying such an attribute would cause QML to store a pointer to the value in question rather than a copy.
There are interesting questions about life time management of such pointers in relation to their "parent" values: "Inner" properties and lists of value types and lists would have to be invalidated whenever the property or list changes. "Outer" properties of QObjects would generally be tied to the object's life time.
Attachments
Issue Links
- relates to
-
QTBUG-118847 cpp object property getter is called too often for local qml var access
- Reported
-
QTBUG-113159 Manipulating QLists exposed through Q_PROPERTY causes unnecessary detaches
- Reported
-
QTBUG-126306 Clarify if and when data is copied when passed between C++ and QML/JS
- Reported
-
QTBUG-102779 Allow detaching of value types when writing to a QML-defined property
- Closed