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

List:       pykde
Subject:    Re: [PyKDE] Error when overloading QTable.paintCell
From:       Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date:       2003-06-13 16:36:31
[Download RAW message or body]

On Friday 13 June 2003 5:17 pm, Frederick Polgardy Jr wrote:
> Weird, if you add the QColorGroup arg to both (the other overloaded version
> of the method), you then get the opposite exception!:
>
> ...
>     def paintCell(self, painter, row, col, rect, selected, cg):
>         QTable.paintCell(self, painter, row, col, rect, selected, cg)
> ...
>
> TypeError: paintCell() takes exactly 7 arguments (6 given)
>
> Could SIP be mixing up which version is getting mapped to which C++ method?

Remember that Python doesn't support methods with the same name but with 
different signatures - you have to handle this explicitly in code.

What you need to do is something like this...

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

Phil

_______________________________________________
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