[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] PyQt C API
From: Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date: 2005-10-18 17:02:21
Message-ID: 200510181802.21894.phil () riverbankcomputing ! co ! uk
[Download RAW message or body]
On Tuesday 18 October 2005 5:39 pm, Jim Bublitz wrote:
> On Tuesday 18 October 2005 00:44, Toby Dickenson wrote:
> > I am considering translating a few functions of our large PyQt
> > application to C (or, probably, pyrex) as a performance optimisation, but
> > I have stumbled at the first hurdle. How do you convert a PyObject
> > pointer to a PyQt object into a pointer to the Qt C++ object?
> >
> > Thanks in advance,
>
> Is this what you mean?
>
> PyObject *elem; // Points to QRect object type
> QRect *cpp;
> int iserr = 0;
>
> cpp = (QRect *)sipForceConvertTo_QRect (elem, &iserr);
> if (iserr)
> {
> *sipIsErr = 1;
> return 0;
> }
>
> The only thing that would change in most cases is substituting the
> particular Qt object type of interest for QRect everywhere. The "sipIsErr"
> is part of %MappedTypeCode - probably won't apply most places.
Or you can use the lower level sipConvertToCpp() which skips some error
checking.
Phil
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic