Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946
QFontMetrics::boundingRect() returns wrong text width
DenProg last edited by
I want to get a text width. I need to know this width before rendering of the text.
So I do:
QRectF b1 = m.boundingRect(QRect(0, 0, 0, 0), Qt::AlignCenter, text);@
After that when I render this text I do:
QRectF b2 = painter->boundingRect(QRect(0, 0, 0, 0), Qt::AlignCenter, text);@
font and text are the same. But I get different width. Why and how can I get the same one?