I\'m very confused about using destructors in Qt4 and hope, you guys can help me.
When I have a method like this (with \"Des\" is a class):
void Widget::
Another option to using deleteLater()
, or parents, is to use the delete-on-close functionality for widgets. In this case, Qt will delete the widget when it is done being displayed.
Des *test = new Des;
test->setAttribute( Qt::WA_DeleteOnClose );
test->show();
I like to use it with the object tree that Qt keeps, so that I set delete-on-close for the window, and all widgets in the window have a proper parent specified, so they all get deleted as well.