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

TextInput/TextEdit not de-focused when !enabled

    XMLWordPrintable

Details

    Description

      Run the code below. Click on the text to focus it (note that the
      background turns green). Press anywhere outside (on the white) to
      set the TextEdit.enabled to false. This should result in the TextEdit
      loosing focus (cursor disappearing) and the background turning red,
      but it doesn't.

      import QtQuick 2.0
      
      Rectangle {
          width: 300; height: 400
      
          MouseArea {
              id: mouseArea
              anchors.fill: parent
          }
      
          TextEdit {
              id: textEdit
              anchors.centerIn: parent
      
              enabled: !mouseArea.pressed
      
              text: "Press mouse button\noutside to !focus"
              font.bold: true
      
              Rectangle {
                  anchors.fill: parent
                  z: -1
                  color: parent.activeFocus ? "green" : "red"
              }
          }
      }
      

      Attachments

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

        Activity

          People

            denexter Andrew den Exter (closed Nokia identity) (Inactive)
            mathiasm Mathias Malmqvist
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes