import QtQuick import QtQuick.Window Window { id:box width: 640 height: 480 visible: true title: qsTr("Hello World") Rectangle { id: blueSquare width: 120; height: 120 x: box.width - width - 10; y: 10 color: "blue" Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent } MouseArea { anchors.fill: parent //! [drag] drag.target: blueSquare drag.axis: Drag.XAndYAxis drag.minimumX: 0 drag.maximumX: box.width - parent.width drag.minimumY: 0 drag.maximumY: box.height - parent.width //! [drag] } } }