[~~help~~ workaround found] insert a single line break in html (Qt6 RichText)
Hello! I’m writing my application in QML, and inside a TextArea formatted with RichText I want to display this:
a header
(an empty line)
another header
my first thought was to go with a <br>
tag, but it has a problem: it creates 2 empty lines, don’t know why. so doing this
<span style="color:#323232;"><</span><span style="color:#63a35c;">h1</span><span style="color:#323232;">>hello</</span><span style="color:#63a35c;">h1</span><span style="color:#323232;">>
</span><span style="color:#323232;"><</span><span style="color:#63a35c;">br</span><span style="color:#323232;">>
</span><span style="color:#323232;"><</span><span style="color:#63a35c;">h2</span><span style="color:#323232;">>world</</span><span style="color:#63a35c;">h2</span><span style="color:#323232;">>
</span>
produces
hello
(an empty line)
(an empty line)world
I tried using the <pre>
tag:
<span style="color:#323232;"><</span><span style="color:#63a35c;">pre</span><span style="color:#323232;">>
</span><span style="color:#323232;"></</span><span style="color:#63a35c;">pre</span><span style="color:#323232;">>
</span>
but no empty lines were displayed
the only working workaround was to use a non breaking space
, but being it a TextArea, the user is able to edit the text, and so there would be a “rogue” space instead of an empty line. How can I display just a single line break between two headers (or even paragraphs, but in my case the header is needed)?
Add comment