[PyKDE] Qtable Cell Painting Redux
matt at finaldraftbooks.com
Sun Apr 3 20:49:37 BST 2005
Ah... when you edit a cell, it creates a lineEdit widget which you then
have to set the background on...
From: pykde-bounces at mats.imk.fraunhofer.de
[mailto:pykde-bounces at mats.imk.fraunhofer.de] On Behalf Of Matthew Singer
Sent: Saturday, April 02, 2005 7:21 PM
To: pykde at mats.imk.fraunhofer.de
Subject: [PyKDE] Qtable Cell Painting Redux
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?
def cellColor(self, row, col):
return self._cellColor.get((row,col), Qt.white)
def paintCell(self, p, row, col, cr, selected, cg = None):
myc = QColorGroup(cg)
myc.setColor(QColorGroup.Base, self.cellColor(row, col))
QTable.paintCell(self, p, row, col, cr, selected, myc)
QTable.paintCell(self, p, row, col, cr, selected)
def beginEdit(self, row, col, replace):
self.setCellColor( row, col, Qt.red)
QTable.beginEdit(self, row, col, replace)
Final Draft Booksellers
Purcellville, VA 20132
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt