[PyQt] Drag and Drop when using designer

Jan Ekholm jan.ekholm at smultron.net
Thu Oct 25 10:30:20 BST 2007

On Thursday 25 October 2007, Andreas Pakulat wrote:
> On 25.10.07 04:22:39, Nahuel Defossé wrote:
> > Hi!
> >
> > I've made all my gui with designer. I have some List Views there that
> > need drag and drop funcitonality so I need to add them some methods to
> > handle the drop events properly, and set the accept drops to True... but
> > I can't add those methods with setattr, they don't work, it seems I have
> > to subclass the List Views.
> I'm not sure if thats really needed, never created itemviews that can do
> drag and drop. The puzzle example indicates however that you don't need
> to change the listviews, only the underlying model which needs to
> provide mimeData and dropMimeData and probably also mimeTypes. Then you
> just need to enable the drag/drop on the listviews by setting their dnd
> properties to true.

At least I couldn't get DnD to work without subclassing and providing 
something in the dragEnterEvent, dragMoveEvent and dropEvent handlers. But it 
did work fine when following the docs at:


Jan Ekholm
jan.ekholm at smultron.net

More information about the PyQt mailing list