[PyQt] How are template methods supposed to work?

Shaheed Haque srhaque at theiet.org
Sat Apr 9 17:01:15 BST 2016


Hi,

I'm having some trouble trying to wrap KDE's KF5 libraries in the area
of template support using SIP 4.16.9. For example, the following test
case results in a syntax error:

======
%Module test_template

class MyClass
{
public:
    template <typename T>  // line 6
    int mymethod();
};
======

$ sip test_template.sip
sip: test_template.sip:6: syntax error


I've poked around PyQt4, PyQt5 and PyKDE4, and though I see a
scattering of templated classes, I don't see any templated methods.
The docs (and the parser.y, if I am reading it right) do suggest that
this should work. What am I missing? Does SIP really support templates
generally?

Now I confess to being a little unclear what the Pythonic
representation of such a thing might be, and if SIP does not support
this, any suggestions on how to approach this kind of problem would be
welcome.

Thanks, Shaheed


More information about the PyQt mailing list