Below code allows the small red coloured rectangle to be dragged in an area which is a rectangle defined by minimum and maximum drag values.

I want it to go on only up till the boundary of the parent rectangle whose radius is 100 which means that it is now a circle.

How to make an item drag inside a circle in QML?

Qt Code:
  1. Window {
  2. width: 200; height: 200; visible: true
  3.  
  4. Rectangle
  5. {
  6. x: 10; y: 10
  7. width: 200; height: 200
  8. radius: 100
  9. color: "blue"
  10.  
  11. Rectangle {
  12. x: 10; y: 10
  13. width: 20; height: 20
  14. color: "red"
  15.  
  16. MouseArea
  17. {
  18. id: dragArea
  19. anchors.fill: parent
  20.  
  21. drag.target: parent
  22. drag.minimumX : 20
  23. drag.maximumX : 150
  24.  
  25. drag.minimumY : 20
  26. drag.maximumY : 150
  27. }
  28. }
  29. }
  30. }
To copy to clipboard, switch view to plain text mode