[Qt-interest] Keep Same QGraphicsItem's Pen Width Across Scaling

Jason H scorp1us at yahoo.com
Fri Oct 2 16:40:03 CEST 2009


I think is you set pen width to 0, it will always give you one physical pixel of outline.




----- Original Message ----
From: cyril.mailing.list <cyril.mailing.list at gmail.com>
To: Josiah Bryan <jbryan at productiveconcepts.com>
Cc: Qt-interest <qt-interest at trolltech.com>
Sent: Friday, October 2, 2009 9:47:30 AM
Subject: Re: [Qt-interest] Keep Same QGraphicsItem's Pen Width Across Scaling

Josiah Bryan a écrit :
> I've got a custom QGraphicsItem (simple box) that draws an outline 
> around itself, say 3px wide. Great for "normal" live view. However, my 
> app also renders an "icon" view of the scene that the box is in - this 
> "icon" is about 96x96. Then there's also the "preview" view of the scene 
> before it goes live, this is rendered about 320x240. The live scene is 
> scaled approx 1:1, so its about 1024x768.
>
> What I'm wondering is if there's any way for my custom graphics item to 
> find out the scale it's being rendered at so that it can adjust it's pen 
> width accordingly inorder to render at approx 3px width regardless of 
> scale? (The outline isn't always 3px - it can vary depending on various 
> other factors [type of box, datapoint the box represents, etc]).
>
> Any ideas on how to find the scale of the scene from inside the paint 
> method of my graphics item?
>
> Thanks!
> -josiah
>
>
>  
My understanding of your problem is that you're looking for so-called 
'cosmetic' pens.
see QPen::setCosmetic(bool)
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




More information about the Qt-interest-old mailing list