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

TextField causing activeFocus of the calling item to be triggered multiple times.

    XMLWordPrintable

Details

    • All, Linux/X11, Windows
    • 23691ba87 (dev), d49aa4022 (6.7), 33f342d10 (tqtc/lts-6.5)

    Description

      When forceActiveFocus() method of a TextField is called from onActiveFocusChanged of an Item object, it causes the activeFocus of the calling Item object to be triggered multiple times.

      A code example is provided below:

      import QtQuick 2.15
      import QtQuick.Controls 2.15
      
      ApplicationWindow {
         visible:true
         height: 640
         width: 480
          Component.onCompleted: item.forceActiveFocus()
          Item {
              id: item
              anchors.fill: parent
              onActiveFocusChanged: {
                  console.log("item focus:", activeFocus)
                  textField.forceActiveFocus()
              }
              TextField {
                  id: textField
                  onActiveFocusChanged: {
                      console.log("text field focus:", activeFocus)
                  }
              }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              dorisverria Doris Verria
              mahdi.belila Mehdi Belila
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes