Allow settings to be activated when an app or PC is in focus
This commit is contained in:
parent
d706e81cd4
commit
162a16ed3a
2 changed files with 13 additions and 1 deletions
|
|
@ -47,6 +47,13 @@ ApplicationWindow {
|
||||||
Keys.onMenuPressed: {
|
Keys.onMenuPressed: {
|
||||||
settingsButton.clicked()
|
settingsButton.clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is a keypress we've reserved for letting the
|
||||||
|
// SdlGamepadKeyNavigation object tell us to show settings
|
||||||
|
// when Menu is consumed by a focused control.
|
||||||
|
Keys.onHangupPressed: {
|
||||||
|
settingsButton.clicked()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibilityChanged: {
|
onVisibilityChanged: {
|
||||||
|
|
|
||||||
|
|
@ -142,9 +142,14 @@ void SdlGamepadKeyNavigation::onPollingTimerFired()
|
||||||
sendKey(type, Qt::Key_Escape);
|
sendKey(type, Qt::Key_Escape);
|
||||||
break;
|
break;
|
||||||
case SDL_CONTROLLER_BUTTON_X:
|
case SDL_CONTROLLER_BUTTON_X:
|
||||||
|
sendKey(type, Qt::Key_Menu);
|
||||||
|
break;
|
||||||
case SDL_CONTROLLER_BUTTON_Y:
|
case SDL_CONTROLLER_BUTTON_Y:
|
||||||
case SDL_CONTROLLER_BUTTON_START:
|
case SDL_CONTROLLER_BUTTON_START:
|
||||||
sendKey(type, Qt::Key_Menu);
|
// HACK: We use this keycode to inform main.qml
|
||||||
|
// to show the settings when Key_Menu is handled
|
||||||
|
// by the control in focus.
|
||||||
|
sendKey(type, Qt::Key_Hangup);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue