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

Inconsistent cursor visibility in QQuickTextEdit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.6.0 RC
    • 5.4.0 Alpha, 5.5.0
    • Quick: Other
    • 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
          }
      }
      

        For Gerrit Dashboard: QTBUG-41595
        # Subject Branch Project Status CR V

            ulherman Ulf Hermann
            ulherman Ulf Hermann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes