Fix selection loss when going back caused by previous commit

This commit is contained in:
Cameron Gutman 2019-02-22 22:44:09 -08:00
parent 8037fb76fc
commit ac8183feee
2 changed files with 14 additions and 6 deletions

View file

@ -30,12 +30,16 @@ GridView {
id: gamepadKeyNav id: gamepadKeyNav
} }
Component.onCompleted: {
// Don't show any highlighted item until interacting with them.
// We do this here instead of onActivated to avoid losing the user's
// selection when backing out of a different page of the app.
currentIndex = -1
}
StackView.onActivated: { StackView.onActivated: {
appModel.computerLost.connect(computerLost) appModel.computerLost.connect(computerLost)
gamepadKeyNav.enable() gamepadKeyNav.enable()
// Don't show any highlighted item until interacting with them
currentIndex = -1
} }
StackView.onDeactivating: { StackView.onDeactivating: {

View file

@ -32,14 +32,18 @@ GridView {
id: gamepadKeyNav id: gamepadKeyNav
} }
Component.onCompleted: {
// Don't show any highlighted item until interacting with them.
// We do this here instead of onActivated to avoid losing the user's
// selection when backing out of a different page of the app.
currentIndex = -1
}
StackView.onActivated: { StackView.onActivated: {
gamepadKeyNav.enable() gamepadKeyNav.enable()
// Setup signals on CM // Setup signals on CM
ComputerManager.computerAddCompleted.connect(addComplete) ComputerManager.computerAddCompleted.connect(addComplete)
// Don't show any highlighted item until interacting with them
currentIndex = -1
} }
StackView.onDeactivating: { StackView.onDeactivating: {