View Full Version : QGraphicsView: Need event emitted when line is dropped on rectangle?

25th June 2014, 15:44
I'm building an editor (similar to MS Visio) to draw a hierarchical finite state machine. Hence I need to connect rectangles (states) with lines (transitions) in my drawing area.

I will use a drag and drop approach.

Any idea on how to have an event emitted when a line is dropped (or is connected to) on a rectangle?

25th June 2014, 16:14
If you mean you are moving a line item and want to check whether it currently insects with a rectangle item, see QGraphicsItem::collidesWith and QGraphicsScene::collidingItems.