Hi!
I've recently (a couple of months ago) began learning Qt programming and have a question about coordinate systems in QGraphics classes.
In my test app I have successfully created QGraphicsView control, created scene and added some QGraphicsItem-derived shapes (something like flowchart shapes). This was very easy - thank you devs! The problem occurred when I tried to add QGraphicsTextItem item.
For my program I need that all the shapes sizes to be expressed in metric units (millimeters) and font sizes to be expressed in pts (standard typographic point equal 1/72 inch, AFAIK). I've pretended that logical unit in QGraphicScene is equal to 1 mm and created rectangle of 30x20 mm. Then I've added text using Times New Roman, 12pt font. According to real world units the heights of these two objects have to be related approximately as 5:1 (12pt = 4.233(3)mm while the height of rectangle is 20mm). But I see that on the scene the height of the text is even larger then the height of rectangle.
I've decided that I need to scale dimensions of objects of different types to make them correct for the coordinate system of the scene. First I've tried to scale font, but that small font size (12pt/5 - less than 1mm) completely ruins font kerning and hinting. So now I see that I have to scale my graphical objects.
So my question is how to do that with minimal efforts so that all objects including text look correctly proportional on the screen and on the paper after printing? Is there any standard or commonly used or recommended method of mapping real world units on the QGraphicsScene coordinate system? Is there any example or tutorial of this mapping?
Thanks in advance.
Bookmarks