From ac8183feee0f3d5471a256589f31d25f09931970 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 22 Feb 2019 22:44:09 -0800 Subject: [PATCH] Fix selection loss when going back caused by previous commit --- app/gui/AppView.qml | 10 +++++++--- app/gui/PcView.qml | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/gui/AppView.qml b/app/gui/AppView.qml index f939dbfd..6ead3208 100644 --- a/app/gui/AppView.qml +++ b/app/gui/AppView.qml @@ -30,12 +30,16 @@ GridView { 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: { appModel.computerLost.connect(computerLost) gamepadKeyNav.enable() - - // Don't show any highlighted item until interacting with them - currentIndex = -1 } StackView.onDeactivating: { diff --git a/app/gui/PcView.qml b/app/gui/PcView.qml index 61d1704d..de8bd0f4 100644 --- a/app/gui/PcView.qml +++ b/app/gui/PcView.qml @@ -32,14 +32,18 @@ GridView { 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: { gamepadKeyNav.enable() // Setup signals on CM ComputerManager.computerAddCompleted.connect(addComplete) - - // Don't show any highlighted item until interacting with them - currentIndex = -1 } StackView.onDeactivating: {