How to draw in QGraphicsView with the real size?
-
I want to draw in QGraphicsView with the real size. For example, I need to draw a circle with diameter of 60 mm. So I add item to a scene:
scene->addEllipse(-113, -113, 226, 226);
My screen has DPI as 96, so 60 mm should be 226 pixels.
But after I draw this circle I measured a circle on the screen and I found out it has 55 mm size only.What is the problem ?
-
First I would draw a circle of that size in a drawing program, and look if the actual size is 60mm across. Screen DPI is not always 100 % accurate, and the OS might also muddle up the waters.
Have you checked the values in QScreen::logicalDotsPerInchX and logicalDotsPerInchY?On the graphic view side, you have multiple coordinate system transformations before you get to screen pixels:
Item coordinates -> Scene coordinates -> View coordinates -> Screen coordinates.
Any of these transformations could affect your outcome. So you need to check e.g. that the scene is displayed in the view at 100 %