Details
-
Suggestion
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
6.0
-
None
Description
In Qt5, QObject s are owned and parented by the parent QObject.
Ownership means the lifetime of a QObject is explicitly decided by the parent (usually deleted at dtor of the parent). Parenthood means the functionality is managed or affected by the parent, such as event propagation, or ancestor search (e.g. QWidget::window()), or UI layout, etc.
I suggest we add support for shared ownership of QObject, e.g. by std::shared_ptr. Thus one QObject can be owned by multiple entities, and is automaticly deleted when the last ownership is released. This would enable some much more flexible software structure. However the parenthood would remain the same as before. Each QObject would still have 0 or 1 parent.
I believe this kind of change breaks the binary compatibility. So it is a good opportunity to do it in Qt 6.0.