wishi
wishi

Reputation: 7387

PyQt4 Drag & Drop

Qt4 has support for Drag & Drop actions and I've used them like in the tutorial. Now I want to be able to drag external elements (files) into the GUI form and perform actions based on that (like get the full path and copy it somewhere).

I'm not sure whether this is a limitation like something Qt cannot do. Does someone know how you can do that with Qt? Simply drag a file into a GUI...

Thanks, Marius

Upvotes: 1

Views: 1122

Answers (1)

Johannes Sasongko
Johannes Sasongko

Reputation: 4228

Most file managers provide drag-and-drop data using the text/uri-list target.

Regarding the linked tutorial, first you need to set the widget to accept dropping text/uri-list data, then you can retrieve the URIs by calling event.mimeData().urls(). The return value is a list of QUrl objects.

Upvotes: 3

Related Questions