QPlainTextEdit force redraw

Issue

I’d like to force a redraw over a QPlainTextEdit widget, because my highlighting rules changed. However, all lines and blocks aren’t redrawn, respecting the new rules.

This is true because if I modify a line, the correct highlighting is applied, and I am happy. But I cannot force-modify each block to see any change!

Is there a way to force a redraw? I tried update() and similars, but nothing seems to work.

Thanks!

Solution

You have to call QSyntaxHighlighter::rehighlight() to apply the new highlighting rules to the whole document.

Answered By – cloose

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.