[PyKDE] Painting one cell of a table
Jorge Godoy
godoy at ieee.org
Sun Mar 6 02:17:43 GMT 2005
Hi,
I'm trying to paint one cell in a table but the result is put on the wrong
place. My code is:
row = 2
col = 2
cg = QColorGroup()
cg.setColor(QColorGroup.Base, Qt.red)
cr = self.table1.cellGeometry(row, col)
#cr = self.table1.cellRect(row, col)
print cr.x(), cr.y()
painter = QPainter(self.table1)
self.table1.paintCell(painter, row, col, cr, False, cg)
If I use cellGeometry the print statement shows "200 40". If I use cellRect
it shows "0 0". It doesn't matter with which one, the red cell appears at
position 0, 0 and the table is drawn over it. How can I make the red cell
appears at the row and col given?
I have already tried with QTableItem and the result is the same:
currentItem = self.table1.item(row, col)
currentItem.paint(painter, cg, cr, False)
This message talks about the same problem, but had no answer:
http://lists.trolltech.com/qt-interest/2004-03/thread00108-0.html
Thanks for any hints,
Godoy.
More information about the PyQt
mailing list