Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

close_event->accept() vs qApp->quit()



  • If we have a QMainWindow subclass with:

    MainWindow::closeEvent(QCloseEvent* close_event)
    {
         something ? close_event->accept() : close_event->ignore();
    }
    

    and a main function with

    main ()
    {
        ...
        int return_code = app.exec()
        qDebug() << return_code;
        return return_code;
    }
    

    the debug does not output anything;
    however, it will if we use a different function with qApp->quit().

    What does accepting the close event of a QMainWindow do differently than calling qApp->quit?