code: def sortByColumn(self, index):
          
          if self.sort_old == [None]:
              self.header_class.setSortIndicatorShown(True)
          sort_order = self.header_class.sortIndicatorOrder()
          self.sig_sort_by_column.emit()
          if not self.model().sort(index, sort_order):
              if len(self.sort_old) != 2:
                  self.header_class.setSortIndicatorShown(False)
              else:
                  self.header_class.setSortIndicator(self.sort_old[0],
                                                     self.sort_old[1])
              return
          self.sort_old = [index, self.header_class.sortIndicatorOrder()]
docs: Implement a column sort.