[PyQt] Function pointers and SIP

Giovanni Bajo rasky at develer.com
Fri Jun 19 02:27:02 BST 2009


On gio, 2009-06-18 at 19:01 +0100, Phil Thompson wrote:
> On Thu, 18 Jun 2009 19:40:08 +0200, Giovanni Bajo <rasky at develer.com>
> wrote:
> > Hi Phil,
> > 
> > given a C++ object where you can register callbacks such as:
> > 
> >      void registerCallback(void (*cb)(void*), void* user_data);
> > 
> > or
> > 
> >      void registerCallback(std::tr1::function<void (void)> cb);
> > 
> > how would you wrap them in SIP? Is there some code in PyQt that I can 
> > look at?
> 
> I think you answered this yourself a couple of weeks back.

I had a general idea of course, but I wanted to make sure there was not
automa[tg]ic support by SIP which I wasn't aware of.

> The nearest example in PyQt is probably qInstallMsgHandler().

Thanks. Why the internal qtcore_MsgHandler uses
SIP_BLOCK_THREAD/SIP_UNBLOCK_THREADS? Is that always needed or only if I
have previously explicitly released the GIL?
-- 
Giovanni Bajo
Develer S.r.l.
http://www.develer.com




More information about the PyQt mailing list