I know that, when a QObject
is destroyed, it also destroys all of its children. But, in all my recent Qt code, I've always been declaring the members of any class (say, a QMainWindow
) as direct members, not pointer members, which makes Qt's memory management rarely (if at all) useful.
So, is this parenting property of QObjects
used for something else? From the documentation, it isn't clear if (When you add widgets to a layout, their parent will be set to the parent of the layout, as thuga, pointed out).QBoxLayout::addWidget()
takes ownership of the widget (I think it doesn't).