-
Bug
-
Resolution: Done
-
P2: Important
-
5.4.0 Alpha, 5.5.0
-
None
If you set cursorVisible to false after or in the same frame as setting readOnly to true the cursor will still be visible afterwards. If you make sure that one frame passes after cursorVisible setting cursorVisible to false and only then set readOnly to true the cursor will disappear. Not being able to hide the cursor after setting readOnly may or may not be intentional, but I'm strongly in favor of lifting that restriction, especially since quite often you don't quite know if the cursorVisible has already taken effect and if you can set readOnly now. There are various ways to trigger this behavior accidentally. The following snippet does it intentionally:
import QtQuick 2.2 Rectangle { width: 640 height: 480 Timer { property bool x: true; onTriggered: { editor.readOnly = x; editor.cursorVisible = !x; x = !x; } interval: 5000 repeat: true running: true } TextEdit { id: editor text: "Hello World" color: readOnly ? "red" : "green" readOnly: false cursorVisible: true anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter } }