How do I catch the signal from the main application 'X' button, used to terminate the application?
Printable View
How do I catch the signal from the main application 'X' button, used to terminate the application?
on your header add these:
and then on you c++ file add this.
Code:
connect(xButton,SIGNAL(clicked()),this,xButtonPressed())); MainWindowName::xButtonPressed(){ //app close function }
You don't, it doesn't emit a Qt signal. You can intercept the closing of your program by re-implementing the QWidget::closeEvent() of your top level widget class.Quote:
How do I catch the signal from the main application 'X' button
I hope you are talking about close (X) button at right hand side of title bar of the window. If it is so then.
Yes totally.. It doesn't emit any signal. There is closeEvent() of QWidget either you have to re-implement it, otherwise you can try using event filters.