fix(ui): keep Space for playback after mouse clicks

Controls take focus only via Tab, so a click leaves Space for playback.
This commit is contained in:
tri committed 2026-11-11 20:12:06 +07:00
1 parent 97b4a2fe32
commit 0098641425
5 files changed
+22 -20

No files matched your search

+9 -8
View File
@@ -12,7 +12,8 @@ import org.kde.kirigami as Kirigami
ToolBar {
id: root
// Space activates the focused control before the window's playback action.
// Space activates the focused control before the window's playback action. The
// controls take focus only from Tab, so a click leaves Space for playback.
Keys.onShortcutOverride: event => {
if (event.key === Qt.Key_Space && event.modifiers === Qt.NoModifier) {
event.accepted = true
@@ -40,14 +41,14 @@ ToolBar {
actions: root.actions
mpv: root.mpv
visible: !root.menuBarShown
focusPolicy: Qt.StrongFocus
focusPolicy: Qt.TabFocus
icon.width: root.buttonSize
icon.height: root.buttonSize
}
ToolButton {
action: root.actions.openFile
focusPolicy: Qt.StrongFocus
focusPolicy: Qt.TabFocus
icon.width: root.buttonSize
icon.height: root.buttonSize
display: root.isSmallSize ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
@@ -59,7 +60,7 @@ ToolBar {
ToolButton {
action: root.actions.openUrl
focusPolicy: Qt.StrongFocus
focusPolicy: Qt.TabFocus
icon.width: root.buttonSize
icon.height: root.buttonSize
display: root.isSmallSize ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
@@ -77,7 +78,7 @@ ToolBar {
icon.name: "add-subtitle"
icon.width: root.buttonSize
icon.height: root.buttonSize
focusPolicy: Qt.StrongFocus
focusPolicy: Qt.TabFocus
enabled: root.mpv.fileLoaded
opacity: enabled ? 1.0 : 0.6
display: root.isSmallSize ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
@@ -111,7 +112,7 @@ ToolBar {
icon.name: "audio-volume-high"
icon.width: root.buttonSize
icon.height: root.buttonSize
focusPolicy: Qt.StrongFocus
focusPolicy: Qt.TabFocus
enabled: root.mpv.audioTracks.length > 0
opacity: enabled ? 1.0 : 0.6
display: root.isSmallSize ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon
@@ -162,7 +163,7 @@ ToolBar {
ToolButton {
action: root.actions.cancelTranslation
display: AbstractButton.IconOnly
focusPolicy: Qt.StrongFocus
focusPolicy: Qt.TabFocus
ToolTip.text: text
ToolTip.visible: hovered
@@ -176,7 +177,7 @@ ToolBar {
ToolButton {
action: root.actions.configure
focusPolicy: Qt.StrongFocus
focusPolicy: Qt.TabFocus
icon.width: root.buttonSize
icon.height: root.buttonSize
display: root.isSmallSize ? AbstractButton.IconOnly : AbstractButton.TextBesideIcon