2003-10-27 17:33

Post-facto inheritance

Now, I didn't expect this to work at all!

A QlistView is a sort of tree widget, and is drag&drop enabled.

The trick is, you have to reimplement dragObject() so it returns a draggable thingie after you drag something.

But, since I am using designer to draw the forms, I have to use a real QListView, not a child class.

Conundrum? Custom widget in designer? Not with python!

def myDragObject(self):
return QTextDrag("something",self)


And that works! I know it should work in python, but QListView is implemented in a C++ module!

The guys that did PyQt really made it well.


Comments powered by Disqus

Contents © 2000-2019 Roberto Alsina