def METHOD_NAME(self, watched: QtCore.QObject, event: QtCore.QEvent) -> bool:
    """Tab context menu implementation."""
    if watched == self._tab_bar:
        if event.type() == QtCore.QEvent.ContextMenu:
            pos = event.pos()
            tab_index = self._tab_bar.tabAt(pos)
            tab_widget = self.tabs.widget(tab_index)
            tab_menu = QtWidgets.QMenu(self._tab_bar)
            close_action = tab_menu.addAction(
                "Close", lambda: self._on_tab_close_requested(tab_index)
            )
            if len(self._viewers.get(type(tab_widget), [])) == 1:
                # Only enable the action if there is more than one viewer of this
                # type open.
                close_action.setEnabled(False)
            tab_menu.popup(self._tab_bar.mapToGlobal(pos))
            return True
    return False