mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-02-16 02:30:52 +00:00
Add keyboard/gamepad focus navigation to dialog buttons
This commit is contained in:
@@ -15,7 +15,9 @@ NavigableDialog {
|
|||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
// Force keyboard focus on the label so keyboard navigation works
|
// Force keyboard focus on the label so keyboard navigation works
|
||||||
dialogLabel.forceActiveFocus()
|
if (dialogButtonBox.count > 0) {
|
||||||
|
dialogButtonBox.itemAt(dialogButtonBox.count - 1).forceActiveFocus(Qt.TabFocus)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
@@ -52,18 +54,6 @@ NavigableDialog {
|
|||||||
// will cause word wrap to kick in.
|
// will cause word wrap to kick in.
|
||||||
Layout.maximumWidth: 400
|
Layout.maximumWidth: 400
|
||||||
Layout.maximumHeight: 400
|
Layout.maximumHeight: 400
|
||||||
|
|
||||||
Keys.onReturnPressed: {
|
|
||||||
accept()
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onEnterPressed: {
|
|
||||||
accept()
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onEscapePressed: {
|
|
||||||
reject()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +61,15 @@ NavigableDialog {
|
|||||||
id: dialogButtonBox
|
id: dialogButtonBox
|
||||||
standardButtons: dialog.standardButtons
|
standardButtons: dialog.standardButtons
|
||||||
|
|
||||||
|
delegate: Button {
|
||||||
|
flat: true
|
||||||
|
|
||||||
|
Keys.onReturnPressed: clicked()
|
||||||
|
Keys.onEnterPressed: clicked()
|
||||||
|
Keys.onRightPressed: nextItemInFocusChain(true).forceActiveFocus(Qt.TabFocus)
|
||||||
|
Keys.onLeftPressed: nextItemInFocusChain(false).forceActiveFocus(Qt.TabFocus)
|
||||||
|
}
|
||||||
|
|
||||||
onHelpRequested: {
|
onHelpRequested: {
|
||||||
Qt.openUrlExternally(helpUrl)
|
Qt.openUrlExternally(helpUrl)
|
||||||
close()
|
close()
|
||||||
|
|||||||
Reference in New Issue
Block a user