--- /dev/null
+import Qt 4.7
+
+Item {
+ id:joystick
+ property int xv:(knob.x-(width-knob.width)/2)*(200/(width-knob.width))
+ property int yv:(knob.y-(height-knob.height)/2)*(200/(height-knob.height))
+ width: 200
+ height: 200
+
+ Rectangle {
+ id:knob
+ x:parent.width/2-width/2
+ y:parent.width/2-height/2
+ width:20;
+ height:20;
+ Image {
+ anchors.centerIn:parent
+ id: knobimage
+ source: "joyknob.png"
+ }
+
+ //color:"black"
+ }
+ MouseArea {
+ id:mouse_area
+ anchors.fill:parent
+ drag.minimumX:0
+ drag.minimumY:0
+ drag.maximumX:parent.width-knob.width
+ drag.maximumY:parent.height-knob.height
+ drag.target:knob;
+ onReleased:{knob.x=parent.width/2-knob.width/2;knob.y=parent.height/2-knob.height/2
+ }
+ }
+ }