Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-16627

QTextEdit blinking cursor implementation (caret) does not restart timer when forcing cursor visible

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.7.1, 5.3.1
    • None

    Description

      I found this while debugging QTCREATORBUG-3497, which uses an editor derived from QTextEdit

      The blinking of the cursor (caret) is controlled by a timer in QTextControlPrivate. When enabled, this timer toggles its "cursorOn" boolean member, which in turn controls whether the cursor is visible.

      Whenever the cursor is changed (moved, text inserted, etc), this boolean is set to true. Effectively this means the cursor is visible if you're active, and blinking only when it is stationary.

      However, the way this is currently implemented never restarts the timer, therefore the following can happen (500 ms is example number):

      • Cursor turns on, then 500 ms later:
      • Cursor turns off, then 490 ms later:
      • User presses a key, cursor is made visible, then 10 ms later:
      • Timer fires and turns off the cursor again, so it was only visible for a very short time.

      The attached patch restarts the timer whenever the cursor is forced to be visible.

      IMHO this feels much nicer when editing.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            smd Jan Arve
            dennis Dennis Noordsij
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes