[Qt-interest] QGraphicsTextItem adjustSize()

Sean Harmer sean.harmer at maps-technology.com
Mon Feb 23 19:54:20 CET 2009


Hi,

On Monday 23 February 2009 18:47:06 Stacy Alley wrote:
> Thank you Sean.
> I feel like I understand the scaling part now, but I'm still not seeing
> my text appear.
> If I hard code the font size to some large number I can see the text,
> but when I set the font
> size to a reasonable number (12) and then try to do the p_label->scale
> (1.0/m11(), m.m22() ); line I loose my
> text. Am I missing something?  
That should be:

p_label->scale (1.0/m11(), 1.0/m.m22() );

Don't forget the scaling in the y-direction!

> when do you set your font size and to
> what number?
I just set it to 12 pint in the c'tor of my Plot class which has the 
QGraphicsSimpleTextItem as a member.

I would try boiling it down to a simple example first with just an item that 
sets the scene coord system and a text item. Also useful is to output the 
scale factors to make sure they look sensible.

Sean




More information about the Qt-interest-old mailing list