Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Delayed call of highlightBlock
HojjatJafary last edited by
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.
JonB last edited by
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 delayed
QTimerto 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.