The title bar close tool should trigger closeEvent() when clicked. I guess you want to intercept that and hide() the dialog then ignore the event. Your dialog also has a hideEvent() that you could use.
Closing the window does not destroy the object unless you have set the relevant window Qt::WA_DeleteOnClose attribute. In the typical main() the first main window is allocated on the stack and is not destroyed until the exec() loop exits after all the top-level windows close.
Bookmarks