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

cursor "stuck" in previous field with nextItemInFocusChain().forceActiveFocus()

    XMLWordPrintable

Details

    • WebAssembly

    Description

      When using `nextItemInFocusChain().forceActiveFocus()` to automatically move to the next TextField in the chain the cursor still appears at the previous TextField. It did not happen on 6.7.2.

       

      I have also uploaded a short video which shows what is happening.

       

      Here is a short code snippet that reproduces the bug:

      import QtQuick
      import QtQuick.Controls
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")    
      
      GridView {
              anchors.centerIn: parent
              id: grid
              width: 500
              height: 500
              cellHeight: height / 3
              cellWidth: width / 3        
              interactive: false        
              model: 9
              delegate: Rectangle {
                  width: grid.cellWidth
                  height: grid.cellHeight
                  color: "#D3D3D3"
                  border.color: "black"            
                  
                  TextField {
                      anchors.centerIn: parent
                      maximumLength: 1
                      color: "black"
                      font.pixelSize: 26
                      onTextChanged: {
                          if (text.length === 1) {
                              nextItemInFocusChain().forceActiveFocus()
                          }
                      }
                      background: Rectangle {
                          color: "transparent"
                      }
                  }
              }
          }
      } 

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            oran_mehavi oran mehavi
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes