Add gamepad navigation support for everything except context menus and dialogs

This commit is contained in:
Cameron Gutman
2018-09-30 13:41:32 -07:00
parent 9fb0bffd61
commit d706e81cd4
9 changed files with 291 additions and 14 deletions
+20
View File
@@ -3,6 +3,7 @@ import QtQuick.Controls 2.2
import StreamingPreferences 1.0
import ComputerManager 1.0
import SdlGamepadKeyNavigation 1.0
ScrollView {
id: settingsPage
@@ -12,6 +13,25 @@ ScrollView {
id: prefs
}
// The StackView will trigger a visibility change when
// we're pushed onto it, causing our onVisibleChanged
// routine to run, but only if we start as invisible
visible: false
SdlGamepadKeyNavigation {
id: gamepadKeyNav
}
onVisibleChanged: {
if (visible) {
gamepadKeyNav.setSettingsMode(true)
gamepadKeyNav.enable()
}
else {
gamepadKeyNav.disable()
}
}
Component.onDestruction: {
prefs.save()
}