Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.12.2, 5.12.3, 5.12.4, 5.13.0
-
None
Description
I have a Component that contains a Rectangle (parentRect) and a Component inside that's also a rectangle (childRect). I dynamically create the parentRect and parent it to the window. There's a button that's inside the parentRect and that one creates childRect and parents it to parentRect.
When I re-parent the childRect to another rectangle and destroy the original parentRect, the childRect also gets destroyed but is not removed from the scene. You can see it in action in the video I shared along with the minimal example.
It's my understanding that once the parent of a QObject changes, its life time is bound to its new parent. Although, the context in which the childRect is created is different from the context of its new parentRect. I wonder If that has something to do with it. I could not find related information in the documentation for QQmlContext.