DaveK
DaveK

Reputation: 715

How to set returnKeyType for iOS from QML

I have a QML TextField as an input for a search field. Natively in iOS when a user clicks on the TextField the default iOS keyboard is presented. The "returnKey" of the default iOS keyboard just says "done". I would like it to say "Search" instead.

I see the iOS docs that show the different types of returnKeys you can have, which does list "Search" and an option:

https://developer.apple.com/documentation/uikit/uitextinputtraits/1624446-returnkeytype https://developer.apple.com/documentation/uikit/uireturnkeytype

But I'm not sure how I can access these within QML. Can this be changed from a QML application?

TextField {
    id: textInputSearchTerms
    font.pointSize: 20
    anchors.fill: parent
    placeholderText: "Search..."
    inputMask: qsTr("")
}

I am using Qt 5.12.3

Upvotes: 1

Views: 182

Answers (1)

tomalbrc
tomalbrc

Reputation: 187

This should work as of Qt 5.6:

TextField {
    EnterKey.type: Qt.EnterKeySearch
}

Documentation

Upvotes: 1

Related Questions