def METHOD_NAME(self, event: QMouseEvent):
    if self.window().is_dirty():
        veto = self.window().central_widget.promptToSave()
        if not veto:
            QTreeWidget.METHOD_NAME(self, event)
            QTreeWidget.mouseReleaseEvent(self, event)
        else:
            event.ignore()
    else:
        QTreeWidget.METHOD_NAME(self, event)