[PyQt] Drop to system
David Boddie
david at boddie.org.uk
Thu Sep 9 01:17:59 BST 2010
On Wed Sep 8 22:33:17 BST 2010, Hugo Leveille wrote:
> I have looked at the doc but all I could find was drag and drop within the
> pyqt app itself. What id like to do is the, for exemple, attach an url or
> whatever needed to an item so that if I drag the item into my desktop, in a
> explorer window or whatever othe app that support drag drop, it will
> recongnize it
>
> Some if anyone is nice enought to give me a quick exemple or to point me at
> the specific exemple where it is shown, it would be very nice
It's been a while since I looked at this sort of thing, and the example I
hoped would help me remember doesn't actually do anything with URLs...
You need to set the URL of the MIME data you create when you start a drag
operation:
http://www.riverbankcomputing.com/static/Docs/PyQt4/html/qmimedata.html#setUrls
I seem to remember that you have to supply URLs for certain things to work
on certain systems, and this may mean that you have to save data to a
temporary file, then set the URL of that file, when filling in the MIME data.
Here is one way to do it that doesn't use a temporary file:
http://www.diotavelli.net/PyQtWiki/Exporting_a_file_to_other_applications
The Drop Site example in Qt is useful for looking at the MIME types of data
dragged from other applications. It would be useful if someone ported that
to PyQt.
David
More information about the PyQt
mailing list