My personal preference would be to use the widget attribute and to set it from the code that creates the dialog, i.e.
MyDialog *dialog = new MyDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
dialog->show();
MyDialog *dialog = new MyDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
dialog->show();
To copy to clipboard, switch view to plain text mode
The main motivation for doing it in such an explicit way is that anyone reading the code of the instatiation immediately sees that the deletion is taken care of.
Cheers,
_
Bookmarks