Fix error dialog focus issues after dismissal on Steam Link

This commit is contained in:
Cameron Gutman 2019-03-31 13:57:57 -07:00
commit 81ad1a18fa
7 changed files with 36 additions and 8 deletions

View file

@ -214,7 +214,7 @@ GridView {
} }
} }
MessageDialog { NavigableMessageDialog {
id: quitAppDialog id: quitAppDialog
modality:Qt.WindowModal modality:Qt.WindowModal
property string appName : "" property string appName : ""

View file

@ -78,7 +78,7 @@ Item {
} }
} }
MessageDialog { NavigableMessageDialog {
id: quitAppDialog id: quitAppDialog
modality:Qt.WindowModal modality:Qt.WindowModal
text:"Are you sure you want to quit " + appName +"? Any unsaved progress will be lost." text:"Are you sure you want to quit " + appName +"? Any unsaved progress will be lost."

View file

@ -3,7 +3,7 @@ import QtQuick.Dialogs 1.2
import SystemProperties 1.0 import SystemProperties 1.0
MessageDialog { NavigableMessageDialog {
property string helpText property string helpText
informativeText: SystemProperties.hasBrowser ? helpText : "" informativeText: SystemProperties.hasBrowser ? helpText : ""

View file

@ -0,0 +1,21 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.2
MessageDialog {
property Item originalFocusItem
onVisibleChanged: {
if (!isWindow) {
if (visible) {
originalFocusItem = window.activeFocusItem
}
else {
// We must force focus back to the last item for platforms without
// support for more than one active window like Steam Link. If
// we don't, gamepad and keyboard navigation will break after a
// dialog appears.
originalFocusItem.forceActiveFocus()
}
}
}
}

View file

@ -238,7 +238,7 @@ GridView {
} }
} }
MessageDialog { NavigableMessageDialog {
id: pairDialog id: pairDialog
// don't allow edits to the rest of the window while open // don't allow edits to the rest of the window while open
modality:Qt.WindowModal modality:Qt.WindowModal
@ -250,7 +250,7 @@ GridView {
} }
} }
MessageDialog { NavigableMessageDialog {
id: deletePcDialog id: deletePcDialog
// don't allow edits to the rest of the window while open // don't allow edits to the rest of the window while open
modality:Qt.WindowModal modality:Qt.WindowModal

View file

@ -230,7 +230,13 @@ ApplicationWindow {
ToolTip.delay: 1000 ToolTip.delay: 1000
ToolTip.timeout: 3000 ToolTip.timeout: 3000
ToolTip.visible: hovered ToolTip.visible: hovered
ToolTip.text: "Add a new PC manually" ToolTip.text: "Add PC manually" + (newPcShortcut.nativeText ? (" ("+newPcShortcut.nativeText+")") : "")
Shortcut {
id: newPcShortcut
sequence: StandardKey.New
onActivated: addPcButton.clicked()
}
onClicked: { onClicked: {
addPcDialog.open() addPcDialog.open()
@ -393,7 +399,7 @@ ApplicationWindow {
} }
} }
MessageDialog { NavigableMessageDialog {
id: wow64Dialog id: wow64Dialog
icon: StandardIcon.Warning icon: StandardIcon.Warning
standardButtons: StandardButton.Ok | StandardButton.Cancel standardButtons: StandardButton.Ok | StandardButton.Cancel
@ -415,7 +421,7 @@ ApplicationWindow {
} }
// This dialog appears when quitting via keyboard or gamepad button // This dialog appears when quitting via keyboard or gamepad button
MessageDialog { NavigableMessageDialog {
id: quitConfirmationDialog id: quitConfirmationDialog
icon: StandardIcon.Warning icon: StandardIcon.Warning
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: StandardButton.Yes | StandardButton.No

View file

@ -15,5 +15,6 @@
<file>gui/AutoResizingComboBox.qml</file> <file>gui/AutoResizingComboBox.qml</file>
<file>gui/NavigableMenu.qml</file> <file>gui/NavigableMenu.qml</file>
<file>gui/ErrorMessageDialog.qml</file> <file>gui/ErrorMessageDialog.qml</file>
<file>gui/NavigableMessageDialog.qml</file>
</qresource> </qresource>
</RCC> </RCC>