[Qt-interest] difference between QGraphicsSimpleTextItem and drawText when printing text on printer
changwon lee
bosscq at nexgeo.com
Mon Oct 4 09:16:32 CEST 2010
Hello
I have tried two different method when I draw text.
1. draw using QGraphicsSimpleTextItem
2. derive QGraphicsItem and inside paint function, painter->drawText
I have used same font pointsize.
when I render scene via graphicsview (screen output), there are no
difference between two methods.
but when I render scene to printer, 2nd method has bigger font size.
I have to think about the meaning of pointsize in different context.
I want to check some knowledge.
1. the pointsize of font used in QGrahicsTextItem or
QGraphicsSimpleTextItem is scene unit.
the definition of 1pointsize is 1/72inch doesn't apply in this
case. Scene can draw text consistently irrespective of device.
2. in qpainter context
if I draw text using pointsize 72, is the length of font size always
1 inch regardless of device if there is no scale transformation. right?
what is the relation between this pointsize and logical unit in
window coordinate?
because I have seen some example adjust text location according to
width and height of text.
I don't what is the unit of returned QRect of boundingRect function
in QFontMetrics.
3. why I have to consider dpi of device above 2nd method.
To make results same I have adjust fontsize of 2nd method by screen
dpi/printer dpi.
I want to know how QGraphicsScene acheives device independence in
handling font.
regards
More information about the Qt-interest-old
mailing list