[PyKDE] Qtable Cell Painting Redux

Matthew Singer 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? 

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 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20050403/9e6e9de1/attachment.html


More information about the PyQt mailing list