fix focus movement in ServersListView
This commit is contained in:
parent
ae31bafeb9
commit
fa64c8d68d
1 changed files with 8 additions and 11 deletions
|
|
@ -18,6 +18,8 @@ import "../Config"
|
||||||
ListView {
|
ListView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property int selectedIndex: ServersModel.defaultIndex
|
||||||
|
|
||||||
anchors.top: serversMenuHeader.bottom
|
anchors.top: serversMenuHeader.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|
@ -25,7 +27,6 @@ ListView {
|
||||||
anchors.topMargin: 16
|
anchors.topMargin: 16
|
||||||
|
|
||||||
model: ServersModel
|
model: ServersModel
|
||||||
currentIndex: ServersModel.defaultIndex
|
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBarType {
|
ScrollBar.vertical: ScrollBarType {
|
||||||
id: scrollBar
|
id: scrollBar
|
||||||
|
|
@ -38,11 +39,12 @@ ListView {
|
||||||
Connections {
|
Connections {
|
||||||
target: ServersModel
|
target: ServersModel
|
||||||
function onDefaultServerIndexChanged(serverIndex) {
|
function onDefaultServerIndexChanged(serverIndex) {
|
||||||
root.currentIndex = serverIndex
|
root.selectedIndex = serverIndex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
|
reuseItems: true
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
id: menuContentDelegate
|
id: menuContentDelegate
|
||||||
|
|
@ -68,16 +70,17 @@ ListView {
|
||||||
objectName: "serverRadioButtonRowLayout"
|
objectName: "serverRadioButtonRowLayout"
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
VerticalRadioButton {
|
VerticalRadioButton {
|
||||||
id: serverRadioButton
|
id: serverRadioButton
|
||||||
objectName: "serverRadioButton"
|
objectName: "serverRadioButton"
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
focus: true
|
|
||||||
text: name
|
text: name
|
||||||
descriptionText: serverDescription
|
descriptionText: serverDescription
|
||||||
|
|
||||||
checked: index === root.currentIndex
|
checked: index === root.selectedIndex
|
||||||
checkable: !ConnectionController.isConnected
|
checkable: !ConnectionController.isConnected
|
||||||
|
|
||||||
ButtonGroup.group: serversRadioButtonGroup
|
ButtonGroup.group: serversRadioButtonGroup
|
||||||
|
|
@ -88,17 +91,11 @@ ListView {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
root.currentIndex = index
|
root.selectedIndex = index
|
||||||
|
|
||||||
ServersModel.defaultIndex = index
|
ServersModel.defaultIndex = index
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: serverRadioButton
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
enabled: false
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onEnterPressed: serverRadioButton.clicked()
|
Keys.onEnterPressed: serverRadioButton.clicked()
|
||||||
Keys.onReturnPressed: serverRadioButton.clicked()
|
Keys.onReturnPressed: serverRadioButton.clicked()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue