QFontMetrics and HTML tags
I have many pop-up information panels (QLabels) with text (QStrings). I set the Label width myself, and use QFontMetrics to determine the height.
I've been using "\n" in places where I want to insert a line break. No problem, QFontMetrics handles this fine. I've just discovered that I can use HTML tags (i.e. <b> <i> <font size="+1"> <br>) to modify the text. Unfortunately, "\n" and the HTML tags are not compatable. For a given string, if "\n" appears first, then the HTML tags won't work... and vice-versa.
I could use <br> instead of "\n" for my line breaks... but when I do this, QFontMetrics doesn't pick up on it and my text gets cut-off at the bottom of the Label. Easy fix? (besides counting the number of <br>'s in a given text string and adding that to the QLabel's height. If I have to do something like this: I do I determine the height of a single <br>?)
...or... is there another syntax/tag I can use besides HTML that would work better?
thanks
Re: QFontMetrics and HTML tags
nevermind, i did just that: count the number of "<br>", do a simple fontMet.height(), and multiply/add that to the Label height.
:o
ps: although, just to test... I bracketed my text in
Code:
<font size="+1">...long paragraph here...</font>
just to see what would happen, and as expected QFontMetrics didn't pick up on the change in font size (and the text was cut off at the bottom... but not on the right). I wonder if there's a way to make QFontMetrics take into account HTML tags.