View Full Version : [QTabWidget] parenting (solved)

22nd August 2006, 10:38
method removeTab is documented with the sentence
Does not delete the page widget
I am wondering about which object is responsible for its deletion
after the removal and which was before.
I guess that after, the deletion is at developper charge
and that before, QTabWidget was.
Which leads to a construction of a widget that is to be inserted as a tab,
has to be constructed with no parent. Is that right ?
Thanks in advance.

22nd August 2006, 11:32
QTabWidget will reparent inserted widgets and so they will be destructed correctly upon destruction of the tab widget. But when you explicitly remove a widget at runtime, it is naturally not deleted, because some users might just want to move the widget to another layout or so. So when you want to delete the removed a widget at runtime, you will first have to acquire a pointer to the widget and delete it manually afterwards removal (unless you reparent the widget so that it will get destructed by it's parent later..)