[Qt-interest] Map to view from inside QGraphicsItem::paint()

Josiah Bryan jbryan at productiveconcepts.com
Wed Oct 21 16:12:20 CEST 2009


Stephen Chu wrote:
> In article <4ADC62B8.4020901 at productiveconcepts.com>,
>  Josiah Bryan <jbryan at productiveconcepts.com> wrote:
> 
>> In the absence of any responses, I experimented till I was cross-eyed 
>> and blurry from staring at code. Finally, I came up with a workable 
>> solution:
>>
>>      QRect viewRect = painter->combinedTransform().mapRect(myRect);
> 
> Thanks for leaving this hit. It's really helpful to a Qt newbie like me. 
> But wouldn't the width and height of viewRect be flipped if the the 
> scene is rotated 90 degree?
> 


Good point, Stephen. Ummm... I don't even know, hadn't thought about it. 
I'm not doing any rotation (at the moment) in my scene, so I hadn't 
worried about it. If I get around to it I'll try and report back here. 
Don't know the answer to that one.

-josiah




More information about the Qt-interest-old mailing list