import QtQuick 2.12 import QtQuick.Controls 2.5 import QtQuick.Dialogs 1.3 ApplicationWindow { id: root; width: 800; height: 600; visible: true; title: 'Drag and Drop Sample'; onClosing: Qt.quit(); Rectangle { id: dragItem; x: parent.width / 2 - width / 2; y: parent.height / 2 - height / 2; width: 160; height: 120; color: 'white'; border.color: 'black'; border.width: 3; Drag.active: dragArea.drag.active; Drag.dragType: Drag.Automatic; Drag.mimeData: { "text/plain": "Some random text." } } MouseArea { id: dragArea; drag.target: dragItem; anchors.fill: dragItem; onReleased: console.log('Mouse released'); } }