PDA

View Full Version : Scaling Painter without scaling the coordinate sytem



maverick_pol
7th January 2008, 19:58
Hi guys,

I would like to ask about one small thing. Let's say I have a text which has some width/heigh. I draw it using :


painter->drawText(point,"text");


How to draw the same text, in the same point, but 10 times smaller?
painter->scale(...) scales the coordinate system, but I would like to scale only the text.

THanks

high_flyer
7th January 2008, 20:15
painter->scale(...) scales the coordinate system, but I would like to scale only the text.
How can the text exist with out a coordinate system?

What you do is save the current painter, then you scale, draw, and restore the saved painter.
see QPainter for details, ask if you have more questions.

maverick_pol
7th January 2008, 21:02
Hi,

I did not say that text exists without a coordinate system. Secondly I will try your suggestions.

Thanks for help.

Maverick


Ok. this is the code that works, logically.



painter->scale(0.001,0.001);
painter->drawText(QPointF(x*1000,y*1000),"text").


Text is 1000 times smaller, but still in the same place.

high_flyer
7th January 2008, 21:29
I did not say that text exists without a coordinate system.
Yes you did, but may be you were not aware of it. ;)

painter->scale(...) scales the coordinate system, but I would like to scale only the text.



Text is 1000 times smaller, but still in the same place.
Does it mean you have your problem solved?

maverick_pol
7th January 2008, 21:30
Hi,

ALL in all, thank you for help and interest.
I do appreciate your hints.

Thanks.

Maverick