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;
}
}
}
image.png
需要完整代码请访问QtAndroidExamples
网友评论