[PyKDE] Need help passing PyQt objects to other C++ code

Jack Jansen Jack.Jansen at cwi.nl
Fri Aug 18 15:43:17 BST 2006

[I'm not a member of this mailing list, I hope it's ok to post help  
requests here. If not: could someone please point me in the right  

I need to pass the underlying C++ object for a given PyQt object to  
another module, but I can't seem to find a way to do this.
To be a bit more concrete: I have a Python application that creates a  
QWidget, and I would like to pass the C++ equivalent of that QWidget  
to my own C++ code (which is not wrapped with sip but with bgen, a  
different wrapper-generator).

Initially I thought that sip.voidptr was the solution: Cast the  
QWidget to a sip.voidptr, then pass that to my wrapper (either as a  
CObject, or even as an int, if all else fails:-). But: I can't seem  
to find how to get the sip.voidptr for a given QWidget, even though  
that seems to be exactly what sip.voidptr is meant for, according to  
the documentation. Is this possible at all?

Or am I barking up the wrong tree? I also had a look at the sip API  
for C/C++ code, hoping I could find a method I could pass to  
PyArg_Parse(..., "O&", ...) but no luck. Again, I would even be happy  
with a method that would just return me the bits with no-questions-no- 
guarantees, but I must be looking in the wrong place.

Can someone give me some hints where to look next?

Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma  

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2255 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20060818/ea19b5c1/smime.bin

More information about the PyQt mailing list