[PyQt] sip_api_convert_to_void_ptr returns NULL

Tom Brown nextstate at gmail.com
Sun Feb 7 01:18:22 GMT 2016


After all that I noticed that I can do this:

QRect *qRect = (QRect *)rect;

and then I have access to x1, y1, x2, y2.

But I don't have access to any methods.

Any thoughts?


(The previous post had a minor error. Should have been: QRect *qRect =
sip_api_convert_to_void_ptr( rect );

Thanks!


On Sat, Feb 6, 2016 at 5:06 PM, Tom Brown <nextstate at gmail.com> wrote:

> Hello!
>
> I have created a PyQt4 application on Windows 10 using Visual Studio 2015.
>
> In short, I have compiled SIP 4.17 into a static library so that I can use
> the api "sip_api_convert_to_void_ptr()". This api returns NULL when passed
> a PyObject * containing a QRect.
>
> Although, I am using PyQt4 binaries from Anaconda2-2.4.1.
>
> I have created a Python extension module built with VS 2015. I am passing
> a QRect to a function in the extension.
>
> In the function, I am trying to do this:
>
> PyObject *rect;
>
> /* call python api to convert args to rect */
>
> void *ptr = sip_api_convert_to_void_ptr( rect );
>
> rect = (QRect *)ptr;
>
>
> The debugger always shows that ptr is NULL. Even though rect is a valid
> QRect wrapped by PyQt.
>
> Any ideas on where I am going wrong here?
>
> Thank you!
> Tom
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160206/31b7e99e/attachment-0001.html>


More information about the PyQt mailing list