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.