[PyQt] QMetaObject.newInstance does not work as expected

Phil Thompson phil at riverbankcomputing.com
Sun Dec 4 18:58:00 GMT 2011


On Thu, 1 Dec 2011 17:43:03 +0100, Henning Schröder
<henning.schroeder at gmail.com> wrote:
> Hello,
> again I tried to seek to push the boundaries.This time I tried to load
> a C++ widget inside a library into PyQt using ctypes (without extra
> sip bindings).
> I worked well :) but I cannot call a constructor with arguments.
> The attached code reaches the except-block with PyQt 4.8.5
> To test just call: qmake && make &&  python test.py
> 
> Regards
> Henning

The call to newInstance() should be something like...

    hello = mo.newInstance(Q_ARG(QWidget, win))

Phil


More information about the PyQt mailing list