[PyKDE] sip wrapping QCanvasItem's rtti()

Phil Thompson phil at river-bank.demon.co.uk
Wed Jan 15 00:59:01 GMT 2003


On Tuesday 14 January 2003 11:12 pm, Anthony Heading wrote:
> On Tue, Jan 14, 2003 at 04:45:57PM -0600, Frederick Polgardy Jr wrote:
> > On Tuesday 14 January 2003 04:41 pm, Anthony Heading wrote:
> > > So this appears to be forcing a call to the base class version of the
> > > function, which seems rather inappropriate for an rtti() function...
> > >
> > > Should this not read:
> > >                 res = (QCanvasItem*)sipCpp -> rtti();
> >
> > No it doesn't.  That's the whole point of a virtual function call. 
> > rtti() is invoked on the actual object, it's not determined by the ptr
> > class.
>
> Yes....
>
> Let me restate, I was being sloppy by including the cast at all.
>
> Rather than:
> 		res = sipCpp -> QCanvasItem::rtti();
>
> should we not have:
>
> 		res = sipCpp -> rtti();
>
>
> The current form is forcibly selecting the base class implementation
> of the function.

Yes, so that...

class MyItem(QCanvasItem):
	def rtti(self):
		QCanvasItem.rtti(self)

...doesn't result recurse ad infinitum.

Phil




More information about the PyQt mailing list