79531540

Date: 2025-03-24 15:57:16
Score: 1.5
Natty:
Report link

To get the size of the text, there's only this bit missing:

size = font_metrics.size(0, "daN/cm²")

Which will return the size of the bounding box required to print the string to the box. See the documentation about QFontMetrics for the specifics.

Note that as @musicamante mentionned in the comments, there probably will be more work to do to get the widget the right size to make sure all of the text is properly displayed in all environments.

Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @musicamante
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: S.Comeau