I'm writing a plugin in python for an app that use Qt as framework. I would like to intercept the event closeEvent of the QMainWindow to show an alert if a background process is running. I have access to the QApplication and QMainWindow object only. Is there a way to override the closeEvent like (doesn't work) (or a signal) ? :
mainWindow.closeEvent = self.onCloseEvent
def onCloseEvent(self, event) :
if (self.hasSubProcess()) :
event.ignore()
else :
event.accept()