PDA

View Full Version : Delete objects in Designer



Krish_ng
7th August 2007, 11:14
Is there any way to delete objects created using desgner.I hav an application that makes use of a dialog created using Designer.There is some leak in my app so i tried deleting objects in the destructor.But there is no change in memory leak..Any ideas??

jpn
7th August 2007, 11:27
A QObject deletes its children. All child widgets in the dialog get deleted when the dialog itself is deleted. You just have to make sure the dialog gets properly destructed. Notice that it's preferred to allocate a modal dialog on the stack so it gets automatically destructed when going out of scope.

Krish_ng
7th August 2007, 11:37
I am trying to delete the object in the class its being created.I am giving destroy() in the
close event ,does it mean its deleted ..Does Qt take care of the deletion???

jpn
7th August 2007, 11:42
Use C++ delete operator. You don't need to call QWidget::destroy(), it gets called by QWidget destructor.