PDA

View Full Version : Destructor in QT



hgedek
18th September 2007, 10:38
Lets think we created a form using designer and used it in our application.uic is creating a header file as you know.In it there are many pointers.I want to learn how these are deleted automaticly?
I am deleting them in my class destructor.Will I delete them in my destructor?

marcel
18th September 2007, 10:54
I am deleting them in my class destructor.Will I delete them in my destructor?

A man's gotta do what a man's gotta do.



Lets think we created a form using designer and used it in our application.uic is creating a header file as you know.In it there are many pointers.I want to learn how these are deleted automaticly?

A QObject deletes all its children. Assuming all your widgets are created with the window or dialog(the form) as parent, then they will get deleted when the dialog/window gets deleted.
You don't need to delete them yourself, just make sure you delete the form if you allocate it dynamically.