[vlc-commits] qml: fix key navigation for VolumeWidget

Fatih Uzunoglu git at videolan.org
Mon Dec 7 10:08:23 UTC 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Dec  4 02:01:42 2020 +0300| [3985e5a9695b19ad0bf7f894fc30742c37aed9c8] | committer: Pierre Lamot

qml: fix key navigation for VolumeWidget

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/player/qml/PlayerButtonsLayout.qml | 6 ++++++
 modules/gui/qt/player/qml/VolumeWidget.qml        | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/modules/gui/qt/player/qml/PlayerButtonsLayout.qml b/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
index a42267bb8f..62bc5eda46 100644
--- a/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
+++ b/modules/gui/qt/player/qml/PlayerButtonsLayout.qml
@@ -93,6 +93,12 @@ RowLayout{
 
                 if (index > 0)
                     buttonloader.item.KeyNavigation.left = buttonrow.children[index].item
+
+                if (buttonloader.item.navigationRight !== undefined)
+                    buttonloader.item.navigationRight = playerButtonsLayout.navigationRight
+
+                if (buttonloader.item.navigationLeft !== undefined)
+                    buttonloader.item.navigationLeft = playerButtonsLayout.navigationLeft
             }
         }
     }
diff --git a/modules/gui/qt/player/qml/VolumeWidget.qml b/modules/gui/qt/player/qml/VolumeWidget.qml
index 7afa2e9858..0a076fee65 100644
--- a/modules/gui/qt/player/qml/VolumeWidget.qml
+++ b/modules/gui/qt/player/qml/VolumeWidget.qml
@@ -40,6 +40,11 @@ FocusScope{
 
     property alias parentWindow: volumeTooltip.parentWindow
 
+    // these are uninitialized because they will be set by button loader
+    // not 'undefined' because the loader must know if they exist
+    property var navigationLeft: null
+    property var navigationRight: null
+
     RowLayout{
         id: volumeWidget
         Widgets.IconToolButton{
@@ -118,6 +123,8 @@ FocusScope{
                 }
                 if (right)
                     right.forceActiveFocus()
+                else if (!!navigationRight)
+                    navigationRight()
             }
             Keys.onLeftPressed: {
                 var left = widgetfscope.KeyNavigation.left
@@ -126,6 +133,8 @@ FocusScope{
                 }
                 if (left)
                     left.forceActiveFocus()
+                else if (!!navigationLeft)
+                    navigationLeft()
             }
 
             property color sliderColor: (volControl.position > fullvolpos) ? VLCStyle.colors.volmax : widgetfscope.color



More information about the vlc-commits mailing list