May 12, 2011

Agroni Agroni
Lab Rat
32 posts

How to Drag over other objects?

 

Can someone help me understand how to reference objects like dropbucket001, dropbucket002, dropbucket003 while I drag dragthis over those objects?

What I am trying to do is make the dropbuckets glow or shake or some other visual effect to indicate that you can drop the object on it.

  1.  import QtQuick 1.0
  2.  
  3.  Rectangle {
  4.      id: screen
  5.      color: "white"
  6.      width: 400
  7.      height: 300
  8.  
  9.  
  10. Rectangle {
  11.  id: dropbucket001
  12.  x: 10
  13.  y: 10
  14.  color: "blue"
  15.  width: 60
  16.  height: 60
  17.     }
  18.    
  19. Rectangle {
  20.  id: dropbucket002
  21.  x: 80
  22.  y: 10
  23.  color: "blue"
  24.  width: 60
  25.  height: 60
  26.     }
  27.    
  28. Rectangle {
  29.  id: dropbucket003
  30.  x: 150
  31.  y: 10
  32.  color: "blue"
  33.  width: 60
  34.  height: 60
  35.     }
  36.  
  37. Rectangle {
  38.  id: dragthis
  39.  x: 10
  40.  y: 80
  41.  color: "green"
  42.  width: 50
  43.  height: 50
  44.          MouseArea {
  45.       anchors.fill: parent
  46.              drag.target: dragthis
  47.   }            
  48.  
  49.     }
  50. }

2 replies

May 12, 2011

CMGeorge CMGeorge
Lab Rat
16 posts

  1. Rectangle {
  2.  id: dragthis
  3.  x: 10
  4.  y: 80
  5.  color: "green"
  6.  width: 50
  7.  height: 50
  8.          MouseArea {
  9.       anchors.fill: parent
  10.              drag.target: dragthis
  11. drag.axis = XandYAxis
  12. drag.active = true
  13.   }            
  14.  
  15.     }

 Signature 

iOS & Qt Developer
Happy Qt-ing

May 15, 2011

Agroni Agroni
Lab Rat
32 posts

What are you trying to say CMGeorge?
Did you check your code?

CMGeorge wrote:
@Rectangle { id: dragthis x: 10 y: 80 color: “green” width: 50 height: 50 MouseArea { anchors.fill: parent drag.target: dragthis
drag.axis = XandYAxis
drag.active = true }

}@
 
  ‹‹ Refer global variables from another javascript file      QML, XML List Model, Basic Auth ››

You must log in to post a reply. Not a member yet? Register here!