[PyQt] Empty and template classes

Phil Thompson phil at riverbankcomputing.com
Sun Apr 10 13:32:08 BST 2016


On 10 Apr 2016, at 1:21 pm, Shaheed Haque <srhaque at theiet.org> wrote:
> 
> Hi,
> 
> One enhancement request, and a question. First, SIP 4.16.9 does not
> like empty classes like this:
> 
> class KUserOrGroupId
> {
> };
> 
> The above results in a syntax error. Adding anything makes it work, for example:
> 
> class KUserOrGroupId
> {
> %TypeHeaderCode
> #include <KCoreAddons/kuser.h>
> %End
> };
> 
> is accepted. It would be nice to have support for this corner case.
> Second, the syntax for template classes does not seem to work as I
> expected. This example results in a syntax error, as does every
> variation I could think of (including trying to match PyQt):
> 
> template <typename T>
> class KUserOrGroupId<T>
> {
> %TypeHeaderCode
> #include <KCoreAddons/kuser.h>
> %End
> };
> 
> Like the function case, I realise the implementation for this is not
> trivial (templated methods and the like), but I cannot seem to make
> the basic syntax work. It should, right?

See...

http://pyqt.sourceforge.net/Docs/sip4/specification_files.html#syntax-definition

...also look at the PyQt .sip files.

In this case, omit 'typename'.

Phil


More information about the PyQt mailing list