【问题标题】:How to set returnKeyType for iOS from QML如何从 QML 为 iOS 设置 returnKeyType
【发布时间】:2020-06-24 23:31:10
【问题描述】:

我有一个 QML TextField 作为搜索字段的输入。在 iOS 中,当用户单击 TextField 时,会显示默认的 iOS 键盘。默认 iOS 键盘的“returnKey”只是说“完成”。我希望它改为“搜索”。

我看到 iOS 文档显示了您可以拥有的不同类型的 returnKeys,其中列出了“搜索”和一个选项:

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

【问题讨论】:

    标签: ios qt qml qt5.12


    【解决方案1】:

    这应该从 Qt 5.6 开始工作:

    TextField {
        EnterKey.type: Qt.EnterKeySearch
    }
    

    Documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-27
      • 1970-01-01
      • 2017-02-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多