project file fixes
[mardrone] / mardrone / JoyStick.qml
1 import Qt 4.7
2
3 Item {
4         id:joystick
5         property int xv:(knob.x-(width-knob.width)/2)*(200/(width-knob.width))
6         property int yv:(knob.y-(height-knob.height)/2)*(200/(height-knob.height))
7         width: 200
8         height: 200
9
10         Rectangle {
11             id:knob
12             x:parent.width/2-width/2
13             y:parent.width/2-height/2
14             width:20;
15             height:20;
16             Image {
17                 anchors.centerIn:parent
18                 id: knobimage
19                 source: "joyknob.png"
20             }
21
22             //color:"black"
23         }
24         MouseArea {
25             id:mouse_area
26             anchors.fill:parent
27             drag.minimumX:0
28             drag.minimumY:0
29             drag.maximumX:parent.width-knob.width
30             drag.maximumY:parent.height-knob.height
31             drag.target:knob;
32             onReleased:{knob.x=parent.width/2-knob.width/2;knob.y=parent.height/2-knob.height/2
33             }
34         }
35   }