def __init__(self, data, editable=False): # if not editable just initialise the ItemWidget as string if isinstance(data, V3D): self.is_v3d = True else: self.is_v3d = False if not editable: QTableWidgetItem.__init__(self, str(data)) self.setFlags(self.flags() & ~Qt.ItemIsEditable) return QTableWidgetItem.__init__(self) if isinstance(data, V3D): data = str(data) self.display_data = data # this will correctly turn all number cells into number types self.reset()
def __init__(self, val=u'', style=None): QTableWidgetItem.__init__(self, safe_decode(val)) self._style = style self.update_style()