def METHOD_NAME(self, METHOD_NAME):
    if METHOD_NAME.type() != QtCore.QEvent.Type.User:
        return super().METHOD_NAME(METHOD_NAME)
    self.n_events += 1
    if self.n_events < self.max_n_events:
        new_event = QtCore.QEvent(QtCore.QEvent.Type.User)
        QtCore.QCoreApplication.postEvent(self, new_event)
    return True