Hi, I'm having a problem getting QTextEdit to render a colored font which is preceded by whitespace. It renders with the appearance of each whitespace character overwriting other characters in the string. An example of the problem is ...
import sys
editor.insertHtml(' <font color="Red">HELP</font> <br>')
editor.insertHtml(' <font color="Red">HELP</font> <br>')
editor.insertHtml(' <font color="Red">HELP</font> <br>')
editor.insertHtml(' <font color="Red">HELP</font> <br>')
editor.show()
app.exec_()
import sys
from PyQt5.QtWidgets import QApplication, QTextEdit
app = QApplication(sys.argv)
editor = QTextEdit()
editor.insertHtml(' <font color="Red">HELP</font> <br>')
editor.insertHtml(' <font color="Red">HELP</font> <br>')
editor.insertHtml(' <font color="Red">HELP</font> <br>')
editor.insertHtml(' <font color="Red">HELP</font> <br>')
editor.show()
app.exec_()
To copy to clipboard, switch view to plain text mode
I would expect to get output of ...
HELP
HELP
HELP
HELP
HELP
HELP
HELP
HELP
To copy to clipboard, switch view to plain text mode
But the actual visible output is ...
HELP
HEL
HE
H
HELP
HEL
HE
H
To copy to clipboard, switch view to plain text mode
Removing the trailing does render the output as expected but is required in the real code for formatting.
Any advice to get this working would be much appreciated.
Bookmarks