[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    RE: [PyKDE] Qtable Cell Painting Redux
From:       "Matthew Singer" <matt () finaldraftbooks ! com>
Date:       2005-04-03 19:49:37
Message-ID: 464JDcTxp0084M38 () cmsapps02 ! cms ! usa ! net
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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 


[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Qtable Cell Painting Redux</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2604" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=788374819-03042005>Ah... when you edit a cell, &nbsp;it creates a lineEdit 
widget which you then have to set the background on...</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=788374819-03042005></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=788374819-03042005></SPAN></FONT>&nbsp;</DIV><FONT face=Arial 
color=#0000ff size=2></FONT><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> pykde-bounces@mats.imk.fraunhofer.de 
[mailto:pykde-bounces@mats.imk.fraunhofer.de] <B>On Behalf Of </B>Matthew 
Singer<BR><B>Sent:</B> Saturday, April 02, 2005 7:21 PM<BR><B>To:</B> 
pykde@mats.imk.fraunhofer.de<BR><B>Subject:</B> [PyKDE] Qtable Cell Painting 
Redux<BR></FONT><BR></DIV>
<DIV></DIV><!-- Converted from text/rtf format -->
<P><FONT face=Arial size=2>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.</FONT></P>
<P><FONT face=Arial size=2>The code below doesn&#8217;t change the color until another 
cell if clicked. I've tried everything (except of course what works).</FONT></P>
<P><FONT face=Arial size=2>Anyone see what I'm doing wrong?</FONT> </P>
<P><FONT face=Arial size=2>Thanks</FONT> </P><BR>
<P><FONT face=Arial size=2>&nbsp;def cellColor(self, row, col):</FONT> <BR><FONT 
face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
self._cellColor.get((row,col), Qt.white)</FONT> </P>
<P><FONT face=Arial size=2>&nbsp;def paintCell(self, p, row, col, cr, selected, 
cg = None):</FONT> <BR><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if cg:</FONT> <BR><FONT 
face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; myc = 
QColorGroup(cg)</FONT> <BR><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
myc.setColor(QColorGroup.Base, self.cellColor(row, col))</FONT> <BR><FONT 
face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
QTable.paintCell(self, p, row, col, cr, selected, myc) </FONT><BR><FONT 
face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:</FONT> 
<BR><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
QTable.paintCell(self, p, row, col, cr, selected)</FONT> </P>
<P><FONT face=Arial size=2>&nbsp;def beginEdit(self, row, col, replace):&nbsp; 
</FONT><BR><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self.setCellColor( row, col, Qt.red)</FONT> <BR><FONT face=Arial 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.repaint()</FONT> 
<BR><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
QTable.beginEdit(self, row, col, replace)</FONT> </P><BR><BR>
<P><FONT face=Arial size=2>---------------------------------</FONT> <BR><FONT 
face=Arial size=2>Matthew Singer</FONT> <BR><FONT face=Arial size=2>Final Draft 
Booksellers</FONT> <BR><FONT face=Arial size=2>Purcellville, VA&nbsp; 
20132</FONT> </P></BODY></HTML>


_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic