On Mon, 16 Aug 2010 11:38:06 +0100, Jeremy Sanders <[email protected]> wrote: > Hello - is this the correct way to return a QImage from a SIP MethodCode? > > QImage numpyToQImage(SIP_PYOBJECT, SIP_PYOBJECT, bool forcetrans = false); > %MethodCode > { > try > { > Numpy2DObj data(a0); > Numpy2DIntObj colors(a1); > QImage *img = new QImage( numpyToQImage(data, colors, a2) ); > sipRes = img; > } > catch( const char *msg ) > { > sipIsErr = 1; PyErr_SetString(PyExc_TypeError, msg); > } > } > %End > > numpyToQImage returns a QImage. > > It seems to work, but is there a memory leak? Should I be transferring > ownership here?
No - it's correct as it is. Phil _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
