[vlc-devel] [PATCH 06/21] qml: fix miniplayer keyboard navigation
Fatih Uzunoglu
fuzun54 at outlook.com
Sat Nov 7 17:53:25 CET 2020
---
modules/gui/qt/player/qml/ControlButtons.qml | 12 ++++++++-
modules/gui/qt/player/qml/MiniPlayer.qml | 26 ++++++++++++++++++++
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index 27c7bdebcf..ffaf37192d 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -147,7 +147,7 @@ Item{
Component{
id:playBtnDelegate
- Button {
+ ToolButton {
id: playBtn
width: VLCStyle.icon_medium
height: width
@@ -165,6 +165,16 @@ Item{
property bool realHovered: false
+ Keys.onPressed: {
+ if (KeyHelper.matchOk(event) ) {
+ event.accepted = true
+ }
+ }
+ Keys.onReleased: {
+ if (!event.accepted && KeyHelper.matchOk(event))
+ mainPlaylistController.togglePlayPause()
+ }
+
contentItem: Label {
id: contentLabel
color: videoOverlays ? (playBtn.enabled ? playBtn.color : playBtn.colorDisabled)
diff --git a/modules/gui/qt/player/qml/MiniPlayer.qml b/modules/gui/qt/player/qml/MiniPlayer.qml
index 57d86c5232..d85a1c44d9 100644
--- a/modules/gui/qt/player/qml/MiniPlayer.qml
+++ b/modules/gui/qt/player/qml/MiniPlayer.qml
@@ -81,6 +81,9 @@ Widgets.NavigableFocusScope {
left: parent.left
right: parent.right
}
+
+ Keys.onDownPressed: buttonrow_left.focus = true
+ Keys.onUpPressed: root.navigationUpItem.focus = true
}
@@ -125,6 +128,15 @@ Widgets.NavigableFocusScope {
navigationParent: root
navigationRightItem: buttonrow_center
+
+ focus: true
+
+ navigationUp: function(index) {
+ if (progressBar.enabled)
+ progressBar.focus = true
+ else
+ root.navigationUp(index)
+ }
}
PlayerButtonsLayout {
@@ -141,6 +153,13 @@ Widgets.NavigableFocusScope {
navigationParent: root
navigationLeftItem: buttonrow_left
navigationRightItem: buttonrow_right
+
+ navigationUp: function(index) {
+ if (progressBar.enabled)
+ progressBar.focus = true
+ else
+ root.navigationUp(index)
+ }
}
PlayerButtonsLayout {
@@ -156,6 +175,13 @@ Widgets.NavigableFocusScope {
navigationParent: root
navigationLeftItem: buttonrow_center
+
+ navigationUp: function(index) {
+ if (progressBar.enabled)
+ progressBar.focus = true
+ else
+ root.navigationUp(index)
+ }
}
}
--
2.25.1
More information about the vlc-devel
mailing list