[Qt-interest] Cosmetic QGraphicsItems

Nadia Pio nadiapio at gmail.com
Fri Jan 30 16:27:28 CET 2009


Thank you very much guys!
It worked!
Nadia

2009/1/30 Tony Rietwyk <tony.rietwyk at rightsoft.com.au>:
> 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
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



More information about the Qt-interest-old mailing list