Ah... when you edit a cell,  it creates a lineEdit widget which you then have to set the background on...
 
 


From: pykde-bounces@mats.imk.fraunhofer.de [mailto:pykde-bounces@mats.imk.fraunhofer.de] On Behalf Of Matthew Singer
Sent: Saturday, April 02, 2005 7:21 PM
To: pykde@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?

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