[Qt-interest] Cosmetic QGraphicsItems

Ian Thomson Ian.Thomson at iongeo.com
Fri Jan 30 11:38:57 CET 2009


Hi,

In your paint function of your handles, you might want to try turning 
off the view transformation.

http://doc.trolltech.com/4.4/qpainter.html#setViewTransformEnabled

I don't have an exact idea, so treat this more as a suggestion. If you 
can find out what coordinates your handle should be drawn at, you can 
turn off the transform and draw your rectangle the way you like it.

Cheers,
Ian.


Nadia Pio 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.
> 
> Nadia
> 
> 2009/1/29 Ian Thomson <Ian.Thomson at iongeo.com>:
>> Hi,
>>
>> Depending on what you need, try checking these features out:
>>
>> http://doc.trolltech.com/4.4/qpen.html#setCosmetic
>>
>> QGraphicsItem::ItemIgnoresTransformations
>>
>> Thanks,
>> Ian.
>>
>> Nadia Pio wrote:
>>> Hello,
>>>
>>> I'd like to draw on my GraphicsView, a cosmetic rectangle, that
>>> doesn't scale with the graphicsView. How can I do this?
>>> I've tried to set the scale factor = 1 in my QGraphicsItem paint
>>> function, and then to restore the matrix, but it seems to not work!
>>> Any idea?
>>>
>>> Cheers,
>>> Nadia
>>> _______________________________________________
>>> Qt-interest mailing list
>>> Qt-interest at trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>> This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed.  If you are not the original recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error, and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you received this email in error, please immediately notify the sender and delete the original.
>>
>>
>>
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
> 
> _______________________________________________
> 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