The variable qApp is a global pointer that refers to the single object
application. Equivalent to the pointer returned by the function
QCoreApplication::instance()
, except that in GUI applications, it is a
pointer to an instance of QApplication
.
link
Since% is an instance of qApp
, one of the differences is that the QCoreApplication
method is quit
, that is, it can be used in response to a Qt signal.
Signals & Slots
Another difference between methods is that the SLOT
always returns 0 (zero), whereas the quit
method can receive an integer to return a different code.
void QCoreApplication :: quit ()
void QCoreApplication :: exit (int returnCode = 0)
That is, both methods should be used when the application should be closed, but exit
, which does not allow error code assignment, can be used directly in connection with a signal, and quit
which allows error code assignment, can only be used in the conventional way.