tecknophreak
07-16-2005, 03:08 PM
Let's say I have a qvboxlayout, and add a qhboxlayout with a bunch of widgets, one being a button with a slot. In said slot, if I do a vbox->removeItem(hbox) then delete hbox. How do I get rid of all the children of the hbox?
To quote the QT reference:
"remove Item
Removes the layout item item from the layout. It is the caller's responsibility to delete the item.
Notice that item can be a layout (since QLayout inherits QLayoutItem). "
This doesn't say that I have to delete the children or not.
If I go ahead and delete each of the internal widgets, it works, but this means I have to keep a pointer to each of the widgets. Depending on the application I'll be running in the future, this might be a bunch of widgets(not to mention a real pain).
Of course I could add a vector of widgets which go in the box to my class, but that just seems ugly.
This all coming from a guy who's been working with GTK for a few years now and is used to gtk_widget_destory(widget) cleaning up all the mess for me. ;)
To quote the QT reference:
"remove Item
Removes the layout item item from the layout. It is the caller's responsibility to delete the item.
Notice that item can be a layout (since QLayout inherits QLayoutItem). "
This doesn't say that I have to delete the children or not.
If I go ahead and delete each of the internal widgets, it works, but this means I have to keep a pointer to each of the widgets. Depending on the application I'll be running in the future, this might be a bunch of widgets(not to mention a real pain).
Of course I could add a vector of widgets which go in the box to my class, but that just seems ugly.
This all coming from a guy who's been working with GTK for a few years now and is used to gtk_widget_destory(widget) cleaning up all the mess for me. ;)