[Qt-interest] Cosmetic QGraphicsItems

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Fri Jan 30 12:05:31 CET 2009


Nadia wrote:

> Hello,
> 
> I'm trying to find out a solution to my problem but I can't, so I'll
> explain it better.
> 
> I have to draw a rectangle (custom QGraphicsRectItem) with four resize
> handles(custom QGraphicsRectItem) that are children of the rectangle.
> The graphicsView that shows this rectangle can zoom in and out.
> Now I want the rectangle to scale with the graphicsView and the resize
> handles to be drawn always with 4x4 pixel regarless to the
> graphicsView scale factor.
> 
> I have tryed to set the resize handle flag to
> QGraphicsItem::ItemIgnoresTransformations, has suggested, but this
> doesn't work, because these handles should change position in the view
> as the scale factor changes, and follow the parent rectangle. With
> this solution the resize handles are cosmetic but don't follow the
> parent rectagle corners.
> 
> I hope that someone can help me.
> Thank you.

Hi Nadia, 

Try setting the handles size to be 4 / zoom. That should cancel out the
zoom. 

Hope that helps, 

Tony Rietwyk




More information about the Qt-interest-old mailing list