• 205阅读
  • 0回复

zhengtianzuo系列-QmlAndroid输入法的隐藏和显示 [复制链接]

上一主题 下一主题
离线zhengtianzuo
 

只看楼主 倒序阅读 楼主  发表于: 11-25
Qt Android下显示和隐藏原生的输入法分别是 Qt.inputMethod.show()和Qt.inputMethod.hide()

```
TextEdit{
            id: textEdit
            text: qsTr("输入一些文字")
            font.family: "microsoft yahei"
            font.pixelSize: dpH*15
            height: dpH*24
            width: parent.width - button.width
            horizontalAlignment: Text.AlignHCenter
            selectByKeyboard: true
            selectByMouse: true
            onVisibleChanged: {
                if (visible){
                    Qt.inputMethod.show()
                }else{
                    Qt.inputMethod.hide()
                }
                isClicked = visible
            }
            onActiveFocusOnPressChanged: {
                if (activeFocus){
                    Qt.inputMethod.show()
                    isClicked = true;
                }
            }
        }
```



需要完整代码请访问 QtAndroidExamples
人生很短暂,只做好一件事,并且把它做到极致。
快速回复
限100 字节
 
上一个 下一个