Qt Code:
  1. QObject::~QObject() { qDeleteAll(children); setParent(0); }
  2. void QObject::setParent(QObject *newParent) {
  3. if(parent()) parent()->children().remove(this); // of course ignoring that children() returns a copy
  4. m_parent = newParent;
  5. if(m_parent) m_parent->children().append(this); // of course ignoring that children() returns a copy
  6. }
To copy to clipboard, switch view to plain text mode 
OK, thanks. This is exactly what I was referring to when I asked if deleting a child removed it from its parent's list of children. So my "extra" deletes do no harm (but don't do much good, either). Away with them!

The child widget is reparented to the widget and not to the layout.
Ok, I had known that also, but was trying to keep the explanation more simple.