I have a custom item which inherits QGraphicsItem. It has some child graphics items as member variables. In which order should I remove these items from the scene and how to delete them?
I have a custom item which inherits QGraphicsItem. It has some child graphics items
Share
Create your member graphics items like this:
In that case, it is sufficient to remove only the parent item (
MyClassin this example) from the scene. This will remove all child items as well:Also, when an object of
MyClassgets deleted, it will delete all of its children throughQtmechanics: