PDA

View Full Version : mouse selection of overlapping ellipses



imagyne
20th July 2011, 18:55
I am drawing ellipses using Graphics item in a window (with image in background) and aim to select ellipses using mouse clicks. However, it is not possible for me to select ellipses when they are overlapping. For example, if several ellipses overlap, I can only select the one which is bigger, not the one which are smaller and are (supposedly) inside the bigger ellipse. Can anyone provide some suggestions?

The problem is somewhat related to this http://www.qtcentre.org/threads/37371-Defining-widget-regions-sensitive-to-mouse-events but I can not understand the suggestion on this forum well.

mvuori
21st July 2011, 08:59
I don't have experience of this, but http://doc.qt.nokia.com/latest/qgraphicsitem.html#mousePressEvent says:
"If you call QEvent::ignore() on event, this item will lose the mouse grab, and event will propagate to any topmost item beneath."

So, in principle the graphics items behave differently than widgets and should not have any problems, except the user interface issue of how to handle the clicking further down into the stack until the correct object is found.