如何从 QML 为 iOS 设置 returnKeyType
How to set returnKeyType for iOS from QML
我有一个 QML TextField 作为搜索字段的输入。在 iOS 中,当用户单击 TextField 时,会显示默认的 iOS 键盘。默认 iOS 键盘的 "returnKey" 只是说 "done"。我希望它说 "Search" 而不是。
我看到 iOS 文档显示了您可以拥有的不同类型的 returnKeys,其中确实列出了 "Search" 和一个选项:
https://developer.apple.com/documentation/uikit/uitextinputtraits/1624446-returnkeytype
https://developer.apple.com/documentation/uikit/uireturnkeytype
但我不确定如何在 QML 中访问这些。这可以从 QML 应用程序更改吗?
TextField {
id: textInputSearchTerms
font.pointSize: 20
anchors.fill: parent
placeholderText: "Search..."
inputMask: qsTr("")
}
我正在使用 Qt 5.12.3
从 Qt 5.6 开始这应该可以工作:
TextField {
EnterKey.type: Qt.EnterKeySearch
}
我有一个 QML TextField 作为搜索字段的输入。在 iOS 中,当用户单击 TextField 时,会显示默认的 iOS 键盘。默认 iOS 键盘的 "returnKey" 只是说 "done"。我希望它说 "Search" 而不是。
我看到 iOS 文档显示了您可以拥有的不同类型的 returnKeys,其中确实列出了 "Search" 和一个选项:
https://developer.apple.com/documentation/uikit/uitextinputtraits/1624446-returnkeytype https://developer.apple.com/documentation/uikit/uireturnkeytype
但我不确定如何在 QML 中访问这些。这可以从 QML 应用程序更改吗?
TextField {
id: textInputSearchTerms
font.pointSize: 20
anchors.fill: parent
placeholderText: "Search..."
inputMask: qsTr("")
}
我正在使用 Qt 5.12.3
从 Qt 5.6 开始这应该可以工作:
TextField {
EnterKey.type: Qt.EnterKeySearch
}