mateusz_s
mateusz_s

Reputation: 411

Is it possible to Drag&drop any file into QT application?

is it possible to enable Drag&Drop in QT applications? I mean I want to Drag any file to my application and I want to read its filename and path.

I have been watching examples of drag&drop searching for additional informations but I only figured out that drag&drop works between internal widgets of QT application.

Thanks in advance.

Upvotes: 1

Views: 1326

Answers (1)

Stephen Chu
Stephen Chu

Reputation: 12832

For files dragged over your widget, the QMimeData will have urls which are paths to the files.

From http://doc.qt.io/qt-5/dnd.html#drag-and-drop-actions :

The other major use of drag actions is when using a reference type such as text/uri-list, where the dragged data are actually references to files or objects.

Upvotes: 3

Related Questions