def headerData(self, section, orientation, role=Qt.DisplayRole): if orientation == Qt.Vertical or role != Qt.DisplayRole: return QVariant() elif orientation == Qt.Horizontal: return self.headers[section]