mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-16 21:51:17 +00:00
Use StackView activation callbacks to perform init and cleanup since visibility callbacks aren't guaranteed to run in any order
This commit is contained in:
@@ -28,26 +28,17 @@ Flickable {
|
||||
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()
|
||||
}
|
||||
StackView.onActivated: {
|
||||
gamepadKeyNav.setSettingsMode(true)
|
||||
gamepadKeyNav.enable()
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
StackView.onDeactivating: {
|
||||
gamepadKeyNav.disable()
|
||||
prefs.save()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user