import QtQuick 1.1 FocusScope { id: root width: 360 height: 360 focus: true FocusScope { id: comp anchors.centerIn: parent width: 200 height: 100 focus: true Rectangle { anchors.fill: parent color: root.activeFocus? "red" : "green" } Rectangle { id: rect anchors.centerIn: parent width: 100 height: 50 color: activeFocus? "black" : "white" onActiveFocusChanged: console.log("rect focus changed to " + rect.activeFocus) } onActiveFocusChanged: console.log("comp focus changed to " + comp.activeFocus) Keys.onReturnPressed: { rect.forceActiveFocus() } } onActiveFocusChanged: console.log("root active focus changed to " + root.activeFocus) }