code: def dragEnterEvent(self, event):
          
          mimeData = event.mimeData()
          formats = list(mimeData.formats())
  
          if "parent-id" in formats and \
            int(mimeData.data("parent-id")) == id(self.ancestor):
              event.acceptProposedAction()
  
          QTabBar.dragEnterEvent(self, event)
docs: Override Qt method