[PyKDE] QTable.paintCell() overrides won't work as expected
Hans-Peter Jansen
hpj at urpla.net
Sun Feb 6 20:41:42 GMT 2005
On Sunday 06 February 2005 20:57, Phil Thompson wrote:
> On Sunday 06 February 2005 7:45 pm, Hans-Peter Jansen wrote:
> > Hi Phil,
> >
> > next one (and last for today) is a small but disturbing problem,
> > when subclassing QTable with a paintCell override. See attached
> > script.
> >
> > Funny is, when enabling the XXXpaintCell (7 arg) method, it says:
> > TypeError: paintCell() takes exactly 7 arguments (6 given)
> > while using the YYYpaintCell() (6 arg) method, is says:
> > TypeError: paintCell() takes exactly 6 arguments (7 given)
>
> Might be worth checking the archives for this one - it rings a
> bell.
A very gentle bell, indeed at 13.06.2003 18:36:
Re: [PyKDE] Error when overloading QTable.paintCell
You wrote, that one should use a construct like in such a case:
def paintCell(self, p, row, col, cr, selected, cg = None):
if cg:
myc = QColorGroup(cg)
myc.setColor(QColorGroup.Text, self.cellColor(row, col))
QTable.paintCell(self, p, row, col, cr, selected, myc)
else:
QTable.paintCell(self, p, row, col, cr, selected)
Hmpf, Qt seems to calls this method 2 times for every cell.
Thanks god, the second is the right one (with cg).
Thanks for the tip.
Have a good night,
Pete
More information about the PyQt
mailing list