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

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


Le mar 07/10/2003 à 11:03, Gerard Vermeulen a écrit :

> Oops, my point of view is using boost (or VTK) wrapped objects in sip-files.

ok ...

> I never thought about this.  I work the other way around and for the moment
> I cannot help you.  On the other hand, yesterday evening I started
> considering wrapping a 3D plotting library (qwtplot3d.sf.net) and it has
> a lot of std - lib template code.  So, I am considering mixing sip and boost.
> 
> In a week, I may help you better.
> 
> Gerard

I think I found a solution ! There is a function called
"sipConvertToCpp" that takes a PyObject*, another one pointing on the
base class we expect and return a C++ pointer. This solution seems to
work fine and even do some type testing. This leads me to another
question :

For now, I get the base class argument by getting the "__class__" object
in the python object and verify by its string that it's really a
'Qt.QImage' class. (Boost.Python helps me doing that). But I'd prefer
asking SIP for the PyObject* corresponding to the wanted class. Do
someone know how to do that ? I found some classes called
sipClass_QPixmap for example, but first there is no sipClass_QImage and
second, they're not defined in any header ...

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