PDA

View Full Version : QGraphicsEllipseItem with Handles



stevel
16th April 2008, 23:07
I am trying to create a QGraphicsEllipseItem with resize handles. I have already got a QGraphicsRectItem that is working well, but my resize handles on my Ellipse don't respond to clicks because they are outside the shape. (I.e. inside the bounding Rect, but outside the shape.)

What do I need to override to make it so that you can click on the handles. I have tried overriding contains, but it doesn't seem to be working. (Although I may just have a problem in the code.) What I need is to override the code that decides if a click on the item is really on the item, or not. If I just respond to the mouse down event, it's already too late.

Thanks for any suggestions,

-SteveL

wysota
16th April 2008, 23:33
You need to override shape() to include the handles when the item is selected. You can also position the handles on the ellipse itself

stevel
17th April 2008, 00:00
I was reluctant to override shape, as I didn't want to change the basic shape of the object, but I'll try only overriding it when it's selected, and see how that works.

Thanks.