In an application I'm building I'm displaying some HTML using QTextBrowser. The HTML contains some nested lists, and I'm finding that the last parent item has some extra white space between it and its first child list item.
Simplified example:
list.html:
<ul>
<li>Parent List A
<ul>
<li>A1</li>
<li>A2</li>
</ul>
</li>
<li>Parent List B
<ul>
<li>B1</li>
<li>B2</li>
</ul>
</li>
</ul>
list_test.py:
import sys
from PySide2.QtWidgets import QApplication, QTextBrowser
with open('./list.html') as f:
html = f.read()
app = QApplication()
text_widget = QTextBrowser()
text_widget.setHtml(html)
text_widget.show()
sys.exit(app.exec_())
produces a widget that looks like this:
What's also odd is that it's only ever the last item of the parent list. So, if I add a Parent List C:
list.html:
<ul>
<li>Parent List A
<ul>
<li>A1</li>
<li>A2</li>
</ul>
</li>
<li>Parent List B
<ul>
<li>B1</li>
<li>B2</li>
</ul>
</li>
<li>Parent List C
<ul>
<li>C1</li>
<li>C2</li>
</ul>
</li>
</ul>
it's only that Parent List C that shows this extra white space:
I'm testing this on Windows 10 with PySide2 version 5.11.0