[PyKDE] KXMLGUIFactory.container()

Phil Thompson phil at river-bank.demon.co.uk
Sun Apr 13 22:56:01 BST 2003


On Sunday 13 April 2003 9:34 pm, Gordon Tyler wrote:
> On April 13, 2003 04:14 pm, Phil Thompson wrote:
> > I can't give an easier example than the ones in PyQt. You are defining a
> > table of class names and the corresponding SIP generated data structure
> > that represents the Python type. The table must be in alphabetical order
> > of the class name as it is searched using bsearch().
>
> Okay, I'll give that a try. Does it matter where in the sip file I define
> the %ConvertToSubClassCode block?

It must be part of a class definition, but it doesn't matter which one. I use 
the "main" class of the module, ie. QObject for qt, QCanvas for qtcanvas, 
QTable for qttable etc.

> > > What determines whether a function is a factory function?
> >
> > If it returns a new instance of a class, like a constructor. The tag is
> > needed so that SIP knows that Python is responsible for calling the
> > instance's destructor.
>
> That's not the case here I think. The function is returning instances
> managed by another class so Python doesn't need to call their destructor.

Then I'm surprised, because the KDE docs talk of factory functions.

Phil




More information about the PyQt mailing list