[PyQt] [SIP] SIP_PYCALLABLE in constructor

Phil Thompson phil at riverbankcomputing.com
Thu Oct 31 10:13:16 GMT 2019


On 31/10/2019 09:22, Sandro Mani wrote:
> Hi
> 
> I'm trying to create bindings for a class Foo with a constructor
> taking a std::function, so basically for
> 
>     typedef std::function<Item*()> ItemFactory;
>     Foo( ItemFactory factory, QObject* parent = 0 );
> 
> in the sip file I'm writing
> 
>     Foo( SIP_PYCALLABLE factory, QObject *parent = 0 );

You haven't told SIP what the C++ signature is. You need to do this for 
ctors, virtuals and protected methods. Something like...

     Foo(SIP_PYCALLABLE factory, QObject *parent = 0) [(ItemFactory, 
QObject *)];

Phil


More information about the PyQt mailing list