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

Properties bound to FocusScope's "focus" don't get updated when there's a child item with "focus" set to "true" and "setActiveFocus()" is called on the FocusScope.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 4.8.1
    • Fix Version/s: 5.1.0
    • Labels:
      None
    • Environment:
      Ubuntu 12.04, gcc 4.6, Qt 4.8.1

      Description

      Run the following example (you may uncomment the only commented-away code line to see some more interesting behavior).
      Note that the properties bound to FocusScope's "focus" don't get updated.

      import QtQuick 1.1
      
      FocusScope {
          id: root
      
          width: 600
          height: 200
      
          Item {
              anchors.fill: parent
              focus: true
      
              Text {
                  font.pointSize: 20
                  anchors.centerIn: parent
      
                  text: "foci: " + root.focus //text is aways "foci: false" if the next line is commented
      //             + "/" + root.activeFocus //uncomment to produce "foci: true/true"
              }
          }
      
          property bool rootFocus: root.focus //always false
      
          Keys.onPressed: console.log("key, root.focus: " + root.focus + ", rootFocus: " + rootFocus)
                          //always (true,false)
      
          Component.onCompleted: forceActiveFocus()
      }
      

      The code example above is also attached as a file.

        Attachments

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

          Activity

            People

            Assignee:
            bibr Andreas Aardal Hanssen
            Reporter:
            mlvljr Vladimir M.
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes