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

Does a running timer in the event loop prevent app from terminating?



  • My app process does not appear to terminate when I close the last window (the appropriate flags are set on the window.) Could it be because I have a timer still running?

    I set flags on main window:
    @self.setAttribute(Qt.WA_DeleteOnClose, True)
    self.setAttribute(Qt.WA_QuitOnClose, True)@

    My model is that the QApplication quits when the last top-level window is closed, but the event loop is not the same thing. The QApplication quitting simply means that it takes its handler out of the event loop (the handler that polls for events from the user and window manager.) The event loop only terminates the application process (by returning) if the event loop is empty. Which it will not do if a running timer exists.

    I suppose I could read the source code....

    The context is a functional testing tool, where my timer in the event loop is inspecting the running app.



  • I am quite certain that a pending timer does not prevent the event loop from exiting.


Log in to reply