How to set correct PointSize in a QGraphicsTextItem
-
Hi,
I want to have a QGraphicsTextItem with the correct point size (1pt = 0.3527mm). however 1 unit in my scene is 1 mm.
i tried to call setPointSizeF() with the correct calculated size, but somehow only the pointsize() is called for drawing the text. So only about every third pt the actual font size is changed (3*0.3527 ~ 1.0). How can i change this?Thanks
-
Perhaps your falling in the documentation remark of "setPointSizeF":
"... The requested precision may not be achieved on all platforms"
Did you try using "setPixelSize" (calculating the pixel size corresponding to the desired font height) ?
Something like
@
float lPixelSizeInMillimeters = 0.3527;
float lFontSizeInMillimeters = 12.4:
int lFontSizeInPixels;lFontSizeInPixels = (int)(lFontSizeInMillimeters / lPixelSizeInMillimeters) m_textFont.setPixelSize(lFontSizeInPixels);
@
Hope this is possible and will help...