From 2e9af8fef09c323d410a484f580ff63e3603f171 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 31 Mar 2019 19:40:30 -0700 Subject: [PATCH] Fix focus and rejection of Yes/No dialogs on SL --- app/gui/AppView.qml | 5 +---- app/gui/NavigableMenuItem.qml | 7 +++++++ app/gui/NavigableMessageDialog.qml | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/gui/AppView.qml b/app/gui/AppView.qml index 04f87e92..75f7709e 100644 --- a/app/gui/AppView.qml +++ b/app/gui/AppView.qml @@ -199,10 +199,7 @@ GridView { NavigableMenuItem { parentMenu: appContextMenu text: model.running ? "Resume Game" : "Launch Game" - onTriggered: { - appContextMenu.close() - launchOrResumeSelectedApp() - } + onTriggered: launchOrResumeSelectedApp() } NavigableMenuItem { parentMenu: appContextMenu diff --git a/app/gui/NavigableMenuItem.qml b/app/gui/NavigableMenuItem.qml index 7d9d4960..da7362dc 100644 --- a/app/gui/NavigableMenuItem.qml +++ b/app/gui/NavigableMenuItem.qml @@ -11,6 +11,13 @@ MenuItem { height: visible ? implicitHeight : 0 focusPolicy: visible ? Qt.TabFocus : Qt.NoFocus + onTriggered: { + // We must close the context menu first or + // it can steal focus from any dialogs that + // onTriggered may spawn. + parentMenu.close() + } + Keys.onReturnPressed: { triggered() } diff --git a/app/gui/NavigableMessageDialog.qml b/app/gui/NavigableMessageDialog.qml index d6b7ea64..2a5a22dd 100644 --- a/app/gui/NavigableMessageDialog.qml +++ b/app/gui/NavigableMessageDialog.qml @@ -45,6 +45,10 @@ NavigableDialog { Keys.onReturnPressed: { accept() } + + Keys.onEscapePressed: { + reject() + } } }