Results 1 to 3 of 3

Thread: Method to close the application and go through the close event!?

  1. #1
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Method to close the application and go through the close event!?

    I want to use qApp->exit(0) or qApp->quit() in order to close my application while being in a QDialog (e.g. a button in a dialog saying "Exit").
    qApp->exit and qApp->quit do the job but, as I noticed they don't go through the QClose Event. Is there a way to go through the QClose Event of the main application and not through the dialog's Close Event?
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Method to close the application and go through the close event!?

    Since QApplication is not a QWidget, it is not strange that it doesn't have a closeEvent(). Maybe it would be an idea for you to connect to the QCoreApplication::aboutToQuit() signal.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  3. #3
    Join Date
    Nov 2010
    Posts
    97
    Thanks
    6
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Method to close the application and go through the close event!?

    I just tell the main window to close(). It's sufficient in my case, may not be in yours if you have more than one.

Similar Threads

  1. Replies: 2
    Last Post: 21st August 2010, 11:26
  2. Replies: 1
    Last Post: 26th November 2009, 23:57
  3. close event
    By IRON_MAN in forum Qt Programming
    Replies: 11
    Last Post: 2nd October 2009, 09:12
  4. Close Event for DialogBased Application.
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 12th December 2007, 13:33
  5. Close event
    By gyre in forum Newbie
    Replies: 3
    Last Post: 20th November 2007, 14:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.