Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to link exit menu to the mainwindow's destructor
thomas11live.com.sg last edited by
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.
AcerExtensa last edited by
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.