Why does QWidget not have Qt::WA_DeleteOnClose attribute on by default? Ie Why is the widget not deleted when the widget is closed (On the heap)?
Why does QWidget not have Qt::WA_DeleteOnClose attribute on by default? Ie Why is the widget not deleted when the widget is closed (On the heap)?
Last edited by scarecr0w132; 7th June 2015 at 13:33.
Often you do not want that behaviour. Think about hiding/showing a non-modal toolbox window for example. You could construct it and set it to match the program state every time it is shown (the delete on close case) or construct it once and have it stay in sync with the program state whether hidden or not.
Besides, the vast majority of widgets are children of other widgets; their lifetime is controlled by their parent, therefore Qt::WA_DeleteOnClose is better left off for them.
Bookmarks