[PyKDE] Using SIP to wrap python objects
Rob Knapp
myddrin at myddrin.com
Fri Jun 13 12:37:01 BST 2003
On Friday 13 June 2003 04:21 am, Phil Thompson wrote:
> On Friday 13 June 2003 12:31 am, Rob Knapp wrote:
> > I've found myself in a position where I need to present a python object
> > to a C++ object, and it needs to look like a C++ object. The target
> > application knows nothing of python.
>
> What C++ object does it need to look like?
It needs to be a QObject, more specifically we want it to inherit from QWidget
...which is why SIP looks like such a good match.
> > Would it be possible to create an object using SIP that I can inherit
> > from and use the SIP api to convert into a CppPointer?
>
> If you have a C++ ctor for the object then that's exactly what SIP does, so
> maybe what you want to do is more complicated than your are implying?
So, if I inherit a C++ object from QWidget and write a sip binding, then I'm
set. That's what I thought, but what I was hoping for was some way to
automatically generate this "in between" object.
Here is what I'm trying to do:
Let's say I need to add some slots to QWidget and a couple of methods, I then
need to embed this on a dialog box made by someone else in C++. That dialog
box needs access to these additional methods and slots.
More information about the PyQt
mailing list