Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 1.0
- Rectangle {
- width: 640
- height: 480
- color: "lightyellow"
- Rectangle {
- x: 20
- y: 20
- width: 60
- height: 48
- color: "red"
- MouseArea {
- anchors.fill: parent
- property int startingMouseX: 0
- property int startingMouseY: 0
- onPressed: {
- startingMouseX = mouse.x
- startingMouseY = mouse.y
- }
- onMousePositionChanged: {
- // console.log("MousePositionChanged to " + mouse.x + ", " +mouse.y)
- parent.x += mouse.x - startingMouseX
- parent.y += mouse.y - startingMouseY
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement