QTextEdit - highlighting text on input

14 Views Asked by At

I have a QTextEdit loaded from a file which highlights words which match a model and this works fine. I now want to be able to type text in or paste text in and apply the same highlighting. For the typeing case, I don't want to trigger the highlighting after every key stroke - perhaps on detection of a newline would be an appropriate trigger. For the paste case, can I distinguish between textChanged (someone types 'a') and a paste event? Is there documentation that describes when QSyntaxHighlighter.highlightBlock() is called? How is a text block defined?

0

There are 0 best solutions below