vlc | branch: master | Prince Gupta <[email protected]> | Tue Jan 19 
18:21:00 2021 +0530| [2ba6735fb9fe938545ed473dfba338029e490b53] | committer: 
Pierre Lamot

qml: focus volumebtn on left navigation in VolumeWidget

Signed-off-by: Pierre Lamot <[email protected]>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ba6735fb9fe938545ed473dfba338029e490b53
---

 modules/gui/qt/player/qml/VolumeWidget.qml | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt/player/qml/VolumeWidget.qml 
b/modules/gui/qt/player/qml/VolumeWidget.qml
index 2784b1382f..7e087495cf 100644
--- a/modules/gui/qt/player/qml/VolumeWidget.qml
+++ b/modules/gui/qt/player/qml/VolumeWidget.qml
@@ -51,6 +51,8 @@ FocusScope{
         id: volumeWidget
         Widgets.IconToolButton{
             id: volumeBtn
+
+            focus: true
             paintOnly: widgetfscope.paintOnly
             size: VLCStyle.icon_normal
             iconText:
@@ -68,6 +70,17 @@ FocusScope{
             color: widgetfscope.color
             onClicked: player.muted = !player.muted
             KeyNavigation.right: volControl
+
+            Keys.onLeftPressed: {
+                var left = widgetfscope.KeyNavigation.left
+                while (left && (!left.enabled || !left.visible)) {
+                    left = left.KeyNavigation ? left.KeyNavigation.left : 
undefined
+                }
+                if (left)
+                    left.forceActiveFocus()
+                else if (!!navigationLeft)
+                    navigationLeft()
+            }
         }
 
         Slider
@@ -82,7 +95,6 @@ FocusScope{
             stepSize: 0.05
             value: player.volume
             opacity: player.muted ? 0.5 : 1
-            focus: true
 
             Accessible.name: i18n.qtr("Volume")
 
@@ -133,15 +145,10 @@ FocusScope{
                 else if (!!navigationRight)
                     navigationRight()
             }
+
             Keys.onLeftPressed: {
-                var left = widgetfscope.KeyNavigation.left
-                while (left && (!left.enabled || !left.visible)) {
-                    left = left.KeyNavigation ? left.KeyNavigation.left : 
undefined
-                }
-                if (left)
-                    left.forceActiveFocus()
-                else if (!!navigationLeft)
-                    navigationLeft()
+                volumeBtn.forceActiveFocus()
+                event.accepted = true
             }
 
             property color sliderColor: (volControl.position > fullvolpos) ? 
colors.volmax : widgetfscope.color

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to