OK. I have created a widget that in turn creates child widgets. They are created when the main widget is instantiated. Question is: How do I remove the child widgets when the main widget is closed?

I thought that the following code would make the child wodget dependant there by removing it when the main was exited.


MainClass::MainClass(QWidget *parent){
...

ChildClass chwidget = new ChildClass(this);

....
}