I'm trying to change the background color of a Qtable cell when the user starts to edit it (and leave it colored to mark as a changed field.
The code below doesn’t change the color until another cell if clicked. I've tried everything (except of course what works).
Anyone see what I'm doing wrong?
Thanks
def cellColor(self, row, col):
return
self._cellColor.get((row,col), Qt.white)
def paintCell(self, p, row, col, cr, selected,
cg = None):
if cg:
myc =
QColorGroup(cg)
myc.setColor(QColorGroup.Base, self.cellColor(row, col))
QTable.paintCell(self, p, row, col, cr, selected, myc)
else:
QTable.paintCell(self, p, row, col, cr, selected)
def beginEdit(self, row, col, replace):
self.setCellColor( row, col, Qt.red)
self.repaint()
QTable.beginEdit(self, row, col, replace)
---------------------------------
Matthew Singer
Final Draft
Booksellers
Purcellville, VA
20132