i have the following class
class AssetTableModel(QtCore.QAbstractTableModel):
def __init__(self,filename=''):
super(AssetTableModel,self).__init__()
self.fileName=filename
self.dirty = False
self.assets = []
self.setHeaderData(0,QtCore.Qt.Horizontal,QtCore.QVariant('moayyad'),QtCore.Qt.EditRole)
and i need to change the headers of the columns or the rows ,i used ( self.setHeaderdata())
but its not working ,i have a table that consists of 2 columns and 2 rows only. is there any other function that changes headers ??.
please help
thanx in adnvance
The headers of the columns or the rows will be obtained from your model by the view. The function used to obtain the header data is
virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const(C++ documentation). In order to change the headers shown, you should be able to override this function and return the information you want shown for the proper section/orientation. You might want to check the various roles that you can also have requested.