I just tried a very ugly hack to work around the issue:
TextField {
objectName: "addressBarTextField"
onActiveFocusChanged: {
if (activeFocus) {
var textInput = findChild(textField, "text_input")
console.log("address bar got active focus, text input =", textInput)
textInput.forceActiveFocus()
console.log("after forcing active focus on text input", textInput)
}
}
}
Where findChild() is copied from UbuntuTestCase to recursively search for a given descendant by objectName.
Well I’m seeing this output:
qml: AFI: QQuickTextInput(0xb779c760, "text_input")
qml: address bar got active focus, text input = QQuickTextInput(0xb779c760, "text_input")
qml: after forcing active focus on text input QQuickTextInput(0xb779c760, "text_input")
qml: AFI: TextField_QMLTYPE_61_QML_146(0xb7793c28, "addressBarTextField")
So this hack isn’t even working. But it seems to indicate that active focus is removed from the TextInput, but remains on the ancestor TextField. Why that happens remains to be explained.
I just tried a very ugly hack to work around the issue:
TextField { Field" Changed: { textField, "text_input") log("address bar got active focus, text input =", textInput) .forceActiveFoc us() log("after forcing active focus on text input", textInput)
objectName: "addressBarText
onActiveFocus
if (activeFocus) {
var textInput = findChild(
console.
textInput
console.
}
}
}
Where findChild() is copied from UbuntuTestCase to recursively search for a given descendant by objectName.
Well I’m seeing this output:
qml: AFI: QQuickTextInput (0xb779c760, "text_input") (0xb779c760, "text_input") (0xb779c760, "text_input") QMLTYPE_ 61_QML_ 146(0xb7793c28, "addressBarText Field")
qml: address bar got active focus, text input = QQuickTextInput
qml: after forcing active focus on text input QQuickTextInput
qml: AFI: TextField_
So this hack isn’t even working. But it seems to indicate that active focus is removed from the TextInput, but remains on the ancestor TextField. Why that happens remains to be explained.