[PyKDE] About getting Qt C++ hidden under a PyObject*

Pierre Barbier de Reuille pierre.barbier at cirad.fr
Tue Oct 7 09:54:00 BST 2003


Le lun 06/10/2003 à 16:51, Gerard Vermeulen a écrit :
> Hi,
> 
> I think so, see my post of last Thursday replying Joe Van Andel.
> The attached example concerned Vtk Python objects, but I would try
> the same approach for Boost.
> 
> There may be a few gotchas, though:
> (1) sip generated modules do not use Python's standard way of importing
>     other modules' C-API's. I solve this by patching sip's output.

mmmm ... I really don't see what you are calling "patching the sip's
output".

> (2) it is probably impossible to mix the inheritance hierarchies of
>     sip-generated and boost-generated classes.

Yes, I think so, and I never intent to mix the inheritance classes ... 

> 
> I have a vague recollection of a thread about mixing SIP and Boost.
> 
> Gerard
> 
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

I really don't know how to work with your example. So you imply I have
to re-export the Qt objects ?

Doing some search in a sip documentation, I found the function
"sipGetCppPtr". But if I try to call this function directly from my
non-sip file (a plain C++ file in fact ...) I get a segmentation fault
inside this function. Here some of my code :

void a2_fromQImage(  array2d* a, PyObject *obj )
{
  sipThisType sipThisInfo;
  QImage* img = ( QImage* )sipGetCppPtr( &sipThisInfo, obj );
  if( img != NULL )
    {
	// Do something
    }
}

Do I get something wrong ? Do I need to do some initialisation before
sipGetCppPtr is called (knowing that PyQt has to be loaded before my
module can bo loaded !!!)

Thanks,

-- 
Pierre Barbier de Reuille

INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde
34398 MONTPELLIER CEDEX 5, France

tel   : (33) 4 67 61 65 77    fax   : (33) 4 67 61 56 68 




More information about the PyQt mailing list