PDA

View Full Version : QGraphicsItem, QLineF Precise Selection



prashant
29th October 2009, 08:25
Related to: PyQt4.6

In a custom QGraphicsItem class, I am drawing a line using QLineF. This item is selectable. The problem is that QGraphicsItem's selection is based on bounding box and in case when line is drawn almost diagonally, Clicking even far away from line also make it selectable. Is there any way to make the line selectable when precisely clicking on it. (even margin of 1 or 2 pixel would be fine in case)

aamer4yu
29th October 2009, 10:01
Override QGraphicsItem::shape of your graphics item

Also have a look at the diagram scene example in Qt Demos. (Qt Demos --> Graphics View --> Diagram Scene)