def headerData(self, section, orientation, role=Qt.DisplayRole): if role == Qt.DisplayRole and orientation == Qt.Horizontal: return self._linelist.colnames[section] # This generates tooltips for header cells if role == Qt.ToolTipRole and orientation == Qt.Horizontal: if self._linelist.colnames[section] in [WAVELENGTH_COLUMN, ERROR_COLUMN]: result = self._linelist.columns[section].unit else: # this captures glitches that generate None tooltips if self._linelist.tooltips: result = self._linelist.tooltips[section] else: result = '' return str(result) return QAbstractTableModel.headerData(self, section, orientation, role)
def headerData(self, section, orientation, role=Qt.DisplayRole): """ Overrides the base class """ if role == Qt.DisplayRole and orientation == Qt.Horizontal: return self._linelist.colnames[section] # This generates tooltips for header cells if role == Qt.ToolTipRole and orientation == Qt.Horizontal: if self._linelist.colnames[section] in [WAVELENGTH_COLUMN, ERROR_COLUMN]: result = self._linelist.columns[section].unit else: # this captures glitches that generate None tooltips if self._linelist.tooltips: result = self._linelist.tooltips[section] else: result = '' return str(result) return QAbstractTableModel.headerData(self, section, orientation, role)
def headerData(self, section, orientation, role=Qt.DisplayRole): if role == Qt.DisplayRole and orientation == Qt.Horizontal: return self._table.colnames[section] return QAbstractTableModel.headerData(self, section, orientation, role)