If you have a simple QMainWindow
or even app with single QWidget
, you can connect any button to close()
slot on it and it will close the program. You can even do this in designer without any coding:
But this will cease to work once you have more complex structure where MainMenu
is a child of another widget. Under that circumstances, the close
slot only hides MainMenu
(so you just see black screen) but the application keeps running. I was wondering if there's non-hacky way to terminate the program regardless of the widget hierarchy.
Calling abort
or similar methods are considered hacky. There's allways some cleanup that must occur.