How to link exit menu to the mainwindow's destructor
-
Dear All,
When we close the main window with the close button (located at the top left corner), the main window's destructor is called.
I like to make an exit menu, and how that exit menu can be linked to the main window's destructor, so that when exit menu is selected,
ui is deleted and main window is closed.
Thanks -
You can't "link" it to destructor. Use separate slot for that, call "deleteLater":http://qt-project.org/doc/qt-4.8/qobject.html#deleteLater on window, and close it... Or reimplement "closeEvent":http://qt-project.org/doc/qt-4.8/qwidget.html#closeEvent to do needed cleanups.