[PyKDE] PYKDE Drag and drop

Phil Thompson phil at river-bank.demon.co.uk
Sun Jun 18 11:42:51 BST 2000


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.

Phil




More information about the PyQt mailing list