diff --git a/TexSlot.qml b/TexSlot.qml index 2ba4eb4..551616c 100644 --- a/TexSlot.qml +++ b/TexSlot.qml @@ -11,7 +11,6 @@ DropArea { width: 128 height: 128 - Rectangle { id: rectangle anchors.fill: parent @@ -25,7 +24,30 @@ DropArea { width: 96 height: 96 + MouseArea { + id: imageMouseArea + anchors.fill: parent + + Drag.dragType: Drag.Automatic + Drag.supportedActions: Qt.CopyAction + Drag.mimeData: { + "text/uri-list": filePath + } + + DragHandler { + id: dragHandler + onActiveChanged: + if (active) { + parent.grabToImage(function(result) { + parent.Drag.imageSource = result.url + parent.Drag.active = true + }) + } else { + parent.Drag.active = false + } + } + } } }