[PyKDE] PYKDE Drag and drop
bsarempt at rempt.xs4all.nl
Sun Jun 18 13:45:42 BST 2000
On Sun, 18 Jun 2000, Phil Thompson wrote:
> Jim Bublitz wrote:
> > Two questions/problems with DND:
> > (using PYKDE 0.11/Qt 1.44/KDE 1.2)
> > 2. (This may indicate my unfamiliarity with Python)
> > If I derive a widget, say from QListView, and want
> > to multiply inherit QDropSite, how do I do the
> > QDropSite init (it needs a pointer to the widget
> > to install the event filter)? I have:
> > class KFoo (QListView, QDropSite):
> > def __init__(self, parent):
> > QListView.__init__(self, parent)
> > Do I add:
> > QDropSite.__init__(self, self) ??
> > Also, it seems to make a difference if I do that
> > before or after the QListView call. Of course I
> > can't test this, because (see 1) I'm not getting
> > any events to test it with.
> Sorry - you can't do this in Python. Both the QListView and the
> QDropSite __init__ methods will create separate widgets. The bindings
> only create wrappers for existing C++ classes - what you are trying to
> do is to create a new C++ class, which you can't do from Python.
> If there is no other way of achieving what you want then you will have
> to create KFoo in C++ and then create a new Python module using SIP to
> wrapp the KFoo class.
It should be possible to find a solution in Python. Why not take
a leaf out of the visual basic book, and inherit by aggregation?
Takes a bit more work, but should work like a charm:
Then define all the methods you need and have them call the
right constituent method.
More information about the PyQt