I have a QLabel that's displaying rich text (i. e. a subset of HTML supported by Qt) and uses the <tt>
tag (for monospaced font). This seems to mess up the vertical alignment of the whole label text (not just the monospaced part).
As an example, here are 9 QLabels in a grid layout. The text of the center label is "Text<tt>Label</tt>"
, while the text of the other labels is "TextLabel"
. The text of the center label is aligned 3 pixels lower than the others.
Needless to say, this messes up the layout and causes annoying layout changes when the text is changed to a value that doesn't contain any monospaced font.
How can I get the text to align with the other labels?
Qt 5.5.1 on Ubuntu 16.04 with Gnome 3.18.2.