[Interest] QML: Considerations on an interesting design pattern that relies on JS engine's garbage collection
Fatih Uzunoğlu
fuzun54 at outlook.com
Mon Apr 14 15:05:20 CEST 2025
> Furthermore, anything that has an ID is discoverable in derived scopes
> and contexts. Therefore, nothing that has an ID can be deferred. At
> least not in the current setup. Thus, your example would still not work
> if all properties of type Component were deferred by default.
Yeah, I have provided the `id` here to refer to them in the message. In
the code, I use the property directly (to account for the changed/
overridden property case) and not provide an `id`.
> Making Component deferred by default still requires some
> default-handling of deferred names
That is for the not creation initially if overridden case, the more
important
would be to use garbage collection for `Component` types, as it is used
for both change at arbitrary time, and replace (if not deferred) the initial
component. I guess this essentially means that the QML engine would
not set its parent when it is used in QML, and use
`QJSEngine::JavaScriptOwnership`.
With that, if it is overridden/changed, at least the previous instance
would be destroyed (as it would not have anything that refers to it).
Is this feasible? It is not good to have exceptions for specific types,
but `Component` is already a special type, so that seems fair.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4676 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20250414/b2666f29/attachment.bin>
More information about the Interest
mailing list