我有一个带有边框和
TextInput
,基本上是一个标准文本框。
import QtQuick 2.7
Item {
id: textBox
clip: true
property alias inputText: inputText.text
property alias mode: inputText.echoMode
property color borderColor: "gray"
property int borderWidth: 1
Rectangle {
id: rectInput
anchors.fill: parent
border.color: borderColor
border.width: borderWidth
radius: 4
}
TextInput {
id: inputText
anchors.fill: parent
anchors.leftMargin: 3
verticalAlignment: Text.AlignVCenter
selectByMouse: true
}
}
我有一个包含两个组件的表单。
GridLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: 400
columns: 2
rowSpacing: 10
Text {
id: textName
clip: true
text: "Name: "
}
TextBox {
id: tboxName
Layout.fillWidth: true
height: 30
KeyNavigation.tab: tboxPassword
}
Text {
id: textPassword
clip: true
text: "Password: "
}
TextBox {
id: tboxPassword
Layout.fillWidth: true
height: 30
mode: TextInput.Password
}
...
}
如何在它们之间进行标签导航?我试图补充
KeyNavigation.tab
顺便问一下,QML/Qt-Quick在可交互组件之间真的没有任何默认的选项卡处理吗?所以我们总是要手动指定标签?