import QtQuick 2.0 import Ubuntu.Components 0.1 Item { id: root function dbgfocus(p) { while (p !== null) { console.log(">>>> ", p, p.focus, p.activeFocus) p = p.parent; } console.log("-------------------------") } TextInput { id: txt height: 200 focus: true text: "XXXXXXXXXXXXXXXXXXX" font.pixelSize: 40 } Button { id: b1 anchors.top: txt.bottom text: "Defocus" onClicked: { txt.focus = false root.dbgfocus(txt) } } Button { id: b2 anchors.top: b1.bottom text: "Focus" onClicked: { txt.focus = true root.dbgfocus(txt) } } Label { id: l1 anchors.top: b2.bottom text: "FOCUS: " + txt.focus + " ACTIVE: " + txt.activeFocus } Label { id: l2 anchors.top: l1.bottom text: "ROOT FOCUS: " + root.parent.focus + " ROOT ACTIVE: " + root.parent.activeFocus } }