[PyQt] Droping files over a QWidget

David Boddie david at boddie.org.uk
Fri May 18 15:39:56 BST 2007


On Fri May 18 03:57:43 BST 2007, Nahuel Defossé wrote:

> I'm learning Python and PyQt, I come from Java and C/C++.
> I found PyQt very fast and effective but there's something that's killing
> my brain. I'm trying to drop a file in a QWidget, i'm just interested about
> getting the path. It's a file conversion tool.
> I've implemented dropEvent, and set to Ture acceptDrops, but aparenty the
> function never get invoked...
> Can QWidgets recive desktop drops?

Yes, you just need to implement dragEnterEvent() and accept the drops you
are interested in:

  http://doc.trolltech.com/4.2/dnd.html

You may find it useful to look at some of the examples in the PyQt
distribution.

David



More information about the PyQt mailing list