In Qml, I can start drag and drop using the mime type text/uri-list to trigger the copy action from my application to the file explorer, for example
Item { id: draggable anchors.fill: parent Drag.active: mouseArea.drag.active Drag.hotSpot.x: 0 Drag.hotSpot.y: 0 Drag.mimeData: { "text/uri-list": "file:///home/myname/Desktop/avatar.jpeg" } Drag.supportedActions: Qt.CopyAction Drag.dragType: Drag.Automatic Drag.onDragStarted: { } Drag.onDragFinished: { console.log("Time to copy") } }
or
Item { id: draggable anchors.fill: parent Drag.active: mouseArea.drag.active Drag.hotSpot.x: 0 Drag.hotSpot.y: 0 Drag.mimeData: { "text/uri-list": "https://farm1.staticflickr.com/713/21777111068_e3310cfb94_k.jpg" } Drag.supportedActions: Qt.CopyAction Drag.dragType: Drag.Automatic Drag.onDragStarted: { } Drag.onDragFinished: { console.log("Time to copy") } }
(see also Qt Quick Examples - externaldraganddrop )
This works great when using file: and http: URI.
However, my real data is not available as a URI, but is stored in a database. I canβt quickly save the temperature, because it can take a few seconds, and the user does not want a delay when dragging it.
How can I get the target URI after the fall and do the copying myself? Or can only the target be copied?
In the latter case, do I need to make my data accessible through an internal HTTP server? How do I even know which URI scheme is supported by file browsers on Linux, Windows, and OS X?
source share