我在我的專案中使用 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)
}
}
虛擬鍵盤

uj5u.com熱心網友回復:
如果要檢測虛擬鍵盤何時隱藏,則可以使用Qt.inputMethod:
Connections{
target: Qt.inputMethod
function onVisibleChanged(){
if(Qt.inputMethod.visible){
console.log("show")
}
else{
console.log("hide")
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/349134.html
