[PyQt] sip_api_convert_to_void_ptr returns NULL

Tom Brown nextstate at gmail.com
Sun Feb 7 19:02:07 GMT 2016

What you outlined is what I think I will end up doing. What I am trying to
do is different.

What I have is a PyQt4 application with NO C++ wrapped SIP modules.
I also have a Python extension module written in C++.
I want to pass a QRect from the PyQt4 application to the C++ extension
module and cast it from a PyObject * to a QRect * and be able to access all
of the public methods on the QRect.

The reason for doing this is to push some processing down into the C++
extension module to get better performance in some areas, without porting a
lot of Python code into C++ SIP wrapped classes.

However, it looks like my approach isn't the best way to do this. It is
looking more and more like porting the Python code into C++ SIP wrapped
widgets would be much cleaner in the end.

On Sat, Feb 6, 2016 at 7:53 PM, michael h <michaelkenth at gmail.com> wrote:

>> It seems like creating a C++ QWidget subclass using SIP would be much
>> simpler. Then I could subclass the C++ class in Python, then call methods
>> super class to do the drawing for me.
> Unless I'm missing something SIP will handle python->c++ or c++->python
> QRects (or other Qt types) without extra code on your part if you have
> written a QWidget subclass in C++ and then wrapped it using SIP.
> However, I'm not 100% clear on the exact scenario, so if you could provide
> more information/an example that would be helpful...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160207/d9510de8/attachment-0001.html>

More information about the PyQt mailing list