code: def eventFilter(self, obj, event):
          
          if obj == self.dataTable and event.type() == QEvent.Resize:
              self._resizeVisibleColumnsToContents()
          return False
docs: Override eventFilter to catch resize event.