mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-24 00:47:23 +00:00
Fix focus issues after dismissal of consecutive dialogs (like Add PC -> Add PC error)
This commit is contained in:
@@ -2,27 +2,16 @@ import QtQuick 2.0
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
Dialog {
|
||||
property Item originalFocusItem
|
||||
|
||||
parent: overlay
|
||||
|
||||
x: Math.round((parent.width - width) / 2)
|
||||
y: Math.round((parent.height - height) / 2)
|
||||
|
||||
onAboutToShow: {
|
||||
originalFocusItem = window.activeFocusItem
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
// Force focus on the dialog to ensure keyboard navigation works
|
||||
forceActiveFocus()
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
onAboutToHide: {
|
||||
// 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()
|
||||
stackView.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user