QApplication can't be receiver of its own signal aboutToExit?



  • 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( ) ));
    mIdleTrigger->start(0);
    @

    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.

    Thx.

    [EDIT: code highlighting, Volker]



  • Did you check for run-time connect errors?



  • I didn't follow you, how to check out that? I'm quite new to Qt.

    [quote author="Franzk" date="1294215318"]Did you check for run-time connect errors?[/quote]



  • Check your debug output. It might be that there is some warning about a failed connection. Also try checking the result of the connect call (it returns true on success).



  • ...
    I made a stupid mistake, I forgot to declare "slots", debugging output revealed that.
    Really appreciated.

    [quote author="Franzk" date="1294216225"]Check your debug output. It might be that there is some warning about a failed connection. Also try checking the result of the connect call (it returns true on success).[/quote]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.