Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QApplication can't be receiver of its own signal aboutToExit?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fifth
    wrote on last edited by
    #1

    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]

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      Did you check for run-time connect errors?

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fifth
        wrote on last edited by
        #3

        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]

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Franzk
          wrote on last edited by
          #4

          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).

          "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fifth
            wrote on last edited by
            #5

            ...
            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]

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved