I got some cleanup job before app exit, by following document, I built my own QMyApplication with a private slot cleanup() and got it connected to aboutToExit signal.
However, I found cleanup() was never called.
Then I added another class QMyApplicationHelper (definitely inherited from QObject) to receive aboutToExit instead. That worked.
I was wondering if QApplication can't be receiver of its own signal aboutToExit.
Furthermore, I also tried an idle processing by use of a QTimer with 0 timeout, like
mIdleTrigger = new QTimer(this); // this was QMyApplication itself
connect(mIdleTrigger, SIGNAL ( timeout( ) ), this, SLOT ( processIdle( ) ));
It still never worked until I had QMyApplicationHelper be receiver of timer.
I didn't figure out why there has to be a helper class to take over role of signal receiver.
[EDIT: code highlighting, Volker]