[PyKDE] Aligning Text in a Table

Phil Thompson phil at riverbankcomputing.co.uk
Sat Jun 28 16:02:00 BST 2003


On Saturday 28 June 2003 2:10 pm, Simon Edwards wrote:
> Hi,
>
> > Thanks for your response. I got lost trying to follow your idea. In the
> > past I have subclassed my own classes and reimplemented methods in order
> > to make changes suiting the subclass. But here I cannot even make the
> > simplest reimplementation of paintCell. For example, the method,
> >
> >   def paintCell(self,p,row,col,r,selected):
> >       QTable.paintCell(self,p,row,col,r,selected)
>
> Does this work?:
>
> def paintCell(self,p,row,col,r,selected,cg):
>     QTable.paintCell(self,p,row,col,r,selected,cg)
>
> Maybe PyQt doesn't have the 6 arg version (it's depreciated BTW),

This was discussed on the mailing list within the last 2 weeks. Both the 6 and 
7 argument variations are implemented but, because Python doesn't support 
function overloading, your re-implementation must handle both.

In other words...

def paintCell(self,p,row,col,r,selected,cg = None):
    if cg:
        QTable.paintCell(self,p,row,col,r,selected,cg)
    else:
        QTable.paintCell(self,p,row,col,r,selected)

Phil




More information about the PyQt mailing list