Delayed call of highlightBlock
-
Hi,
Is there any way the highlightBlock method in QSyntaxHighlighter be called after some delay?
It is called immediately while the user is typing I want it to do the highlighting when the user stops writing. -
Hi,
Is there any way the highlightBlock method in QSyntaxHighlighter be called after some delay?
It is called immediately while the user is typing I want it to do the highlighting when the user stops writing.@HojjatJafary
I see the same question asked at https://forum.qt.io/topic/96791/how-to-avoid-qsyntaxhighlighter-highlightblock-blocking-the-ui-thread/3, but not answered.Quite untested, but since you can override
highlightBlock()
maybe you can put in some delayedQTimer
to buffer/delay applying the formatting changes, e.g. till the user stops typing?The problem I can see is that the block could have changed, e.g. be deleted, by the time you come to apply the buffered changes to it. You'd have to play with it to see how it comes out.