Results 1 to 2 of 2

Thread: Instantly closing gui application, not calling Mainwindow close event

  1. #1
    Join Date
    Oct 2015
    Posts
    33
    Thanks
    14
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Instantly closing gui application, not calling Mainwindow close event

    Hey guys,

    I'm trying to exit my gui application instantly withought continuing the execution of my Mainwindow. I do not want to emit a Mainwindow close event. I was trying something like this but it seems to not be working:

    Qt Code:
    1. //get application pointer
    2. QCoreApplication *qapp = QCoreApplication::instance();
    3. //shutdown application with error
    4. qapp->exit(EXIT_FAILURE);
    To copy to clipboard, switch view to plain text mode 

    this seems to be doing nothing thow :/

    I even put a QThread::msleep(5000); after this to make sure it was no issue with the eventloop not being executed quickly enough before the debugger hits an error.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Instantly closing gui application, not calling Mainwindow close event

    QApplication::exit() make the main event loop exit and return from QCoreApplication::exec().

    If you want to exit right away, call the stand-alone/global exit function.

    Cheers,
    _

Similar Threads

  1. Replies: 0
    Last Post: 18th September 2014, 01:00
  2. Closing Modeless Dialogs from MainWindow Application
    By jeffd589 in forum Qt Programming
    Replies: 1
    Last Post: 12th February 2013, 00:36
  3. QT application not close after close the mainwindow
    By artome in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2011, 22:23
  4. Replies: 2
    Last Post: 17th December 2010, 19:01
  5. Calling destructors on close event
    By gyre in forum Newbie
    Replies: 22
    Last Post: 27th November 2007, 19:35

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.