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: rect1 x: 50 y: 25 width: 40 height: 50 focus: true color: activeFocus? "black" : "white" onActiveFocusChanged: console.log("rect1 focus changed to " + rect1.activeFocus) Keys.onLeftPressed: rect2.forceActiveFocus() } Rectangle { id: rect2 x: 110 y: 25 width: 40 height: 50 color: activeFocus? "black" : "white" onActiveFocusChanged: console.log("rect2 focus changed to " + rect2.activeFocus) Keys.onRightPressed: rect1.forceActiveFocus() } onActiveFocusChanged: console.log("comp focus changed to " + comp.activeFocus) } onActiveFocusChanged: console.log("root active focus changed to " + root.activeFocus) }