Reputation: 1061
I have a simple textfield:
TextField {
id: searchField
height: Units.dp * 40
color: Palette.colors["white"]["500"]
textColor: Palette.colors["white"]["500"]
placeholderText: qsTr("Search...")
}
And I'm trying to clear TextField input as following:
function clearSearch() {
Qt.inputMethod.reset()
Qt.inputMethod.hide()
searchField.focus = false
searchField.text = ""
}
It seems that on Android function clearSearch doesn't work. What I see that text input still contains last entered text (I guess it is a displayText). Also I suppose that it is due autocomplete feature of the keyboard.
Am I clearing a text input the wrong way?
My test case:
P.S. Qt 5.5
Upvotes: 3
Views: 3007
Reputation: 5836
You can call Qt.inputMethod.reset()
to reset any partial uncommitted text input from an input method.
Upvotes: 3