Skip to main content
1 of 2
TrsBar
  • 523
  • 2
  • 13

Displaying an alert before closing Qgis

I would like to display a message before Qgis close. But i can't intercept the closeEvent of the main window from my plugin. I've tested this code which doesn't work.

# Main method
QgsApplication.instance().closeEvent = self.mainWindowCloseEvent

def mainWindowCloseEvent(self, event) :
    # displaying message...
    event.ignore()

TrsBar
  • 523
  • 2
  • 13