Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved Delayed call of highlightBlock

    General and Desktop
    2
    2
    79
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • HojjatJafary
      HojjatJafary last edited by

      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.

      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB @HojjatJafary last edited by

        @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 delayed QTimer 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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post