1

Is there a clean way to detect when a QML object such as a Rectangle overlaps another? Here's an example with two Rectangles colliding:

Item {
    anchors.fill: parent
    Rectangle {
       x: 50
       y: 100
       width: 300
       height: 300
       color: "red"
    }

    Rectangle {
       x: 30
       y: 100
       width: 300
       height: 300
       color: "green"
    }
}

Should I use MouseAreas?

Grégoire Borel
  • 1,880
  • 3
  • 33
  • 55
  • 1
    Why don't you just compare x,y? – folibis Apr 04 '17 at 15:10
  • Because I am extremely stupid. God... (: I wasn't using x and y coordinates, but now that I typed them in stackoverflow in order to give an example, it became so obvious. Thanks. – Grégoire Borel Apr 04 '17 at 15:15
  • 2
    :-) see answer to [this](http://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other) question – folibis Apr 04 '17 at 15:20

0 Answers0