code: def headerData(self, section, orientation, role=Qt.DisplayRole):
          
          if role != Qt.DisplayRole:
              return to_qvariant()
          labels = self.xlabels if orientation == Qt.Horizontal else self.ylabels
          if labels is None:
              return to_qvariant(int(section))
          else:
              return to_qvariant(labels[section])
docs: Set header data