0
的代碼創建兩個輸入文本框:如何在QtQuick中將焦點從一個文本框移到另一個文本框?
import QtQuick 1.0
Column
{
width: 500
height: 200
Text
{
id: userInfoTextA
focus: false
text: "Enter a value from 0 to 10:"
}
TextInput
{
id: userInputA
focus: true
anchors.left : userInfoTextA.right
anchors.leftMargin : 20
validator: IntValidator { bottom:0; top: 20 }
Keys.onReturnPressed:
{
console.log (userInputA.text)
}
}
Text
{
id: userInfoTextB
focus: false
text: "Enter a value from 10 to 20:"
}
TextInput
{
id: userInputB
focus: true
anchors.left : userInfoTextB.right
anchors.leftMargin : 20
validator: IntValidator { bottom:0; top: 20 }
Keys.onReturnPressed:
{
console.log (userInputB.text)
}
}
}
在輸出窗口中的焦點,在默認情況下,設置文本框A. 我應該如何通過移動焦點到文本框中B:
1.鍵盤
2.鼠標
?
你說:'當你用鼠標點擊它應該已經轉移焦點;不需要擔心這一點。「實際上,我在那裏看不到一個文本框(用我的代碼),所以我不知道在哪裏點擊。 –