我在我的项目中使用 Qt 虚拟键盘。
我能够在控制台日志中打印所有键的键值(使用 event.key),隐藏键事件(在附图中标记为红色)除外。
谁能帮我捕获虚拟键盘中的隐藏键事件。
下面是捕获按键事件的示例代码
TextField{
id:sampletextfield
width: window.width/1.5
height: parent.height*.5
anchors.centerIn: parent
font.bold: true
font.pixelSize: parent.height*.2
Keys.onReleased: {
console.log("key event = " + event.key)
}
}
虚拟键盘
最佳答案
如果您想检测虚拟键盘何时隐藏,则可以使用 Qt.inputMethod
:
Connections{
target: Qt.inputMethod
function onVisibleChanged(){
if(Qt.inputMethod.visible){
console.log("show")
}
else{
console.log("hide")
}
}
}
关于qt - 如何在 Qt VirtualKeyboard 中捕获隐藏按键事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69814505/