Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Delayed call of highlightBlock

Delayed call of highlightBlock

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 167 Views
  • 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.
  • HojjatJafaryH Offline
    HojjatJafaryH Offline
    HojjatJafary
    wrote on last edited by
    #1

    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.

    JonBJ 1 Reply Last reply
    0
    • HojjatJafaryH HojjatJafary

      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.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @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
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved