I read about owning Qwidgets and deleting them. for example: http://qt-project.org/doc/qt-4.8/objecttrees.html
This says: "You can also delete child objects yourself, and they will be removed from their parents."
However, many of the examples I saw set the parent to null before deleting it. eg:
if (widget != NULL)
{
layout->removeWidget(widget);
widget->setParent(NULL);
delete widget;
}
Is there a need for setParent(NULL);?
It depends on whether there is a reason why I cannot just do
delete layout->itemAt(i);
or
delete layout->takeAt(i);
In fact, is there any real difference between the last two? I assume all my objects are on the heap, of course.