[PyQt] Using Sip on template classes

David Boddie david at boddie.org.uk
Fri May 1 14:54:34 BST 2015

On Fri, 1 May 2015 07:20:53 +0100, Guðjón Guðjónsson wrote: 

> Does anyone have a simple example on sip interface to a template class. I
> have taken a look at qlist.sip and other information I have found on the
> internet but I have to admit that I am too stupid to understand it.
>    I wrote this very simple class and have been trying for several hours to
> write a sip interface to it but without success.

I think the SIP syntax is a little different to C++ syntax for these classes
so it can be confusing. Also, a lot of code that deals with templates is
typically for containers and the SIP equivalent uses the %MappedType
directive to deal with those. However, that's not what you want in this case,
I believe.

I put some code in a couple of places that should help get you started:


Get it from whichever site you're most comfortable with and configure it with

  python configure.py

Then run make as usual. The module should appear in the modules directory,
but it won't be useful until you wrap specific classes of the template type.


More information about the PyQt mailing list