def METHOD_NAME(
    self, selected: QItemSelection, _deselected: QItemSelection
) -> None:
    """Updates the state of the delete button."""
    if selected.empty():
        self.cancel_button.setEnabled(False)
        return
    self.cancel_button.setEnabled(self.can_cancel(selected.indexes()[0]))