[PyQt] Problem sorting a QTable
AmFreak at web.de
AmFreak at web.de
Sat Aug 7 18:27:39 BST 2010
Hi,
i have a list with my Objects that i put in a QTableWidget, I do it like
this:
self.tblData.setItem(self.__row, 0, item1)
self.tblData.setItem(self.__row, 1, item2)
self.tblData.setItem(self.__row, 2, item3)
self.__row += 1
self.tblData.setRowCount(self.tblData.rowCount()+1)
that way the Index of the selected Row is the same as the Index of my
Objectlist.
So if i e.g. delete the 4th row in the table i delete the 4th item in my
list.
My delete Method:
def delFS(self):
del self.__data.dataList[self.tblData.currentRow()]
self.tblData.removeRow(self.tblData.currentRow())
self.__row -= 1
But if i enable sorting and sort the table the Index of my List obviously
isn't the same as the rowIndex anymore.
So is there a way that i can attach a number to a row so that no matter
the sorting i can use that number ?
Or is there another Solution ?
Thanks for any answers in advance
More information about the PyQt
mailing list