CursorDelegate: stop cursor timer when interval is set to 0

The cursor flash iterval can sometimes be set to 0. This is done
from e.g the iOS plugin while selecting text, since the
cursor should not flash when the user is dragging it around
inside a magnifier glass. Setting the interval to 0 simply
means "don't flash", rather than "hide the cursor". But
setting the interval of a QML Timer to 0 will cause it to
never trigger, which is not what we want, since then the
cursor can end up staying hidden if done in-between two
"flashes".

This patch will add an extra condition that checks for this case.

Fixes: QTBUG-75844
Change-Id: Ib1ca594a49a18cb161a2b2a67928fb6766984988
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Richard Moe Gustavsen 2019-05-15 14:58:01 +02:00
parent 7431b0549a
commit c49bb5bda3
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ Rectangle {
Timer {
id: timer
running: cursor.parent.activeFocus && !cursor.parent.readOnly
running: cursor.parent.activeFocus && !cursor.parent.readOnly && interval != 0
repeat: true
interval: Qt.styleHints.cursorFlashTime / 2
onTriggered: cursor.opacity = !cursor.opacity ? 1 : 0