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

onFocusChanged is not emited when the item is inside a FocusScope

    XMLWordPrintable

Details

    • eb8c7d19c98d547f89caa1b5866fd2b5e43b32bf 4ad82cec67ce40dd167be214a2a4dcdcf6236d9d

    Description

      onFocusChanged is not being emitted when the item is inside a FocusScope, even if the FocusScope has activeFocus.

      Steps to reproduce:

      1. Load app.qml below in qmlviewer
      2. Click on each red square. Nothing happen. Expected: the square that got the focus should become yellow
      3. Remove the FocusScope, and it works as expected

      MyComponent.qml
      import Qt 4.7
      
      Rectangle {
      	id: rect
      	width: 100
      	height: 100
      	color: "red"
      
      	states: State {
      		name: "highlight";
      		when: rect.focus 
      		PropertyChanges { target: rect; color: "yellow"}
      	}
      
      	MouseArea {
      		anchors.fill: parent
      		onClicked: {
      			rect.focus = true
      		}
      	}
      }
      
      
      app.qml
      import Qt 4.7
      
      Rectangle {
      	width: 300
      	height: 300
      
      	FocusScope {     // remove the FocusScope and it works
      		focus: true
      		MyComponent {y: 0}
      		MyComponent {y: 130}
      	}
      }
      
      

      Attachments

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

        Activity

          People

            brasser Michael Brasser (closed Nokia identity) (Inactive)
            gregschlom Gregory Schlomoff
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes