PDA

View Full Version : Instantly closing gui application, not calling Mainwindow close event



Lumbricus
19th May 2016, 16:32
Hey guys,

I'm trying to exit my gui application instantly withought continuing the execution of my Mainwindow. I do not want to emit a Mainwindow close event. I was trying something like this but it seems to not be working:



//get application pointer
QCoreApplication *qapp = QCoreApplication::instance();
//shutdown application with error
qapp->exit(EXIT_FAILURE);


this seems to be doing nothing thow :/

I even put a QThread::msleep(5000); after this to make sure it was no issue with the eventloop not being executed quickly enough before the debugger hits an error.

anda_skoa
19th May 2016, 19:29
QApplication::exit() make the main event loop exit and return from QCoreApplication::exec().

If you want to exit right away, call the stand-alone/global exit function.

Cheers,
_