[Qt-interest] cosmetic drawText()
Sean Harmer
sean.harmer at maps-technology.com
Fri May 29 18:02:51 CEST 2009
Hi Andre,
On Friday 29 May 2009 08:41:41 Andre Haupt wrote:
> Hi all,
>
> I use QPainter with an applied QMatrix to scale and translate the
> coordinates according to the data i want to draw.
>
> Drawing lines works as expected if the painters pen is set cosmetic.
> Otherwise the drawn lines will be stretched.
>
> However, if i draw text, setting the pen to cosmetic has no influence
> on the appearing of the text. The text is always drawn stretched.
>
> What am I missing?
I think that drawing lines with a cosmetic pen works because it gets treated
as a infinitesimal width line. The trouble is with drawing text is that each
glyph in a font has an actual extent and so is subject to the scaling
transformation. So, I think that you need to "undo" the scaling part of the
transform by applying the inverse of it to your painter object before calling
drawText().
Cheers,
Sean
More information about the Qt-interest-old
mailing list