Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QPainter FontMetrics returns different values on the same Graphics view and scene
faiszalkhan last edited by
I have two graphics rect items drawn on the same graphics scene and graphics view. I am rendering text on the rect items for which I take font metrics from the painter to calculate text width and height.
As per observation for other graphics items, the value of painter->fontMetrics->height() and painter->fontMetrics->averageCharWidth() increases in value when moving a screen of low dpi to high dpi.
What could be the issue that painter->fontMetrics() is different for the two graphics items which are drawn in the same manner?
Picture for reference: