QPlainTextEdit does not support CSS/HTML line-height because it uses a low-level
QTextDocument + layout engine. So changing <p> styles or using setHtml() has no
effect on QPlainTextEdit.
To change the line spacing, you must modify the QTextBlockFormat of the
document, not the widget:
cursor = self.textCursor()
block = cursor.block()
fmt = block.blockFormat()
fmt.setLineHeight(150, QTextBlockFormat.ProportionalHeight)
cursor.setBlockFormat(fmt)
This applies a proportional line-height (e.g., 150% = 1.5x spacing) to each block.
If you want to apply it to all lines, you can loop through all blocks in the
document and apply the same format.
QPlainTextEdit simply does not support CSS line-height, so adjusting the
QTextBlockFormat is the correct Qt-based solution.