[C++-sig] pyste and virtual classes.

Giulio Eulisse giulio.eulisse at cern.ch
Tue Apr 1 10:12:43 CEST 2003

> > Another possible solution would be get rid of the whole boost/QT idea,
> > and make PyQT and boost play nicely together
> It's not clear that PyQT (SIP) will automatically generate empty
> virtual functions for you either.

The problem is not the virtual function per se. It's the virtual
function requiring QPopupMenu or so: I don't have time, right now, to
implement every single class in QT but I have to if these classes are in
a pure virtual function. PyQT just is much more advanced as for the
number of classes implemented.

> You must mean an abstract class.  There's no such thing as a virtual
> class.

Yes, sorry.

> > which derives from a QT one, this class gets derived into "Derived"
> > and extended in python. An instance of the class "Derived" is
> > created in an embedded python environment and is passed to C++ using
> > something like extract<Base&>.
> It's not clear what you mean by "passed to C++ using
> extract<Base&>".  You can only write extract<Base&> in C++, so the
> object must already be available in C++ code somehow.

I get the "object" from the embedded python environment.

> >  The virtual method MyBase.method() is then called in C++ and its
> > python implementation in Derived gets called.
> **OK so far; I don't see any need to provide a C++ implementation of
> the virtual member function other than the one provided automatically
> by pyste's generated wrapper class.  That alone should be enough to
> ensure that there is no problem with instantiating an abstract base
> class.

The problem is that if you exclude a pure virtual function(because you
don't want to implement the whole QT), the code generated by pyste does
not compile because the wrapping for that function is not generated.

> I don't know the first thing about PyQt, but the real issue is that I
> can't understand the problem you're having.

I want to have a stripped down QT module and since QStyle has a pure
virtual method which requires QPopupMenu, I want to exclude() it.
I can't.


More information about the Cplusplus-sig mailing list