デスクトップ用のQtQuickプロジェクトがあります。それは非常に簡単です:QML Keys.onEnterPressed issue
// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
Rectangle {
width: 360
height: 360
Grid
{
id: xGrid
width: parent.width
height: parent.height
columns: 2
spacing: 1
Rectangle
{
height: parent.height
width: 10
color: "#ff0000"
Text {
id: xText
text: qsTr("t\na\ns")
}
}
TextEdit
{
id: xTextEdit
height: parent.height
width: 350
Keys.onEnterPressed: {
console.log(event.key)
xText.text = (qsTr("A"))
}
}
}
}
私のコードは私が望むように実行されません。 Keys.onEnterPressed
は、even.key
戻り16777220.
この問題を取得する任意のものを撮影していないので、私は私が押したときに、なぜがを入力し、それが動作しKeys.onPressed
ではなく、確かに試すことがないように見えますか?どうすれば解決できますか?
あなたの答えをありがとう!
数字パッド(キーコード16777221)の「Enter」キーを押すと、「Return」キー(16777220)として認識されますか? – alexisdm
はい、私のコードが* Keys.onEnterPressed *をトリガーすることはないと思います! – nvcnvn
あなたはonReturnPressedハンドラを試すことができますか? – Kunal