[vlc-devel] [PATCH 07/27] qml: fix key navigation for VolumeWidget

Fatih Uzunoglu fuzun54 at outlook.com
Fri Dec 4 00:01:42 CET 2020


---
 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
-- 
2.27.0



More information about the vlc-devel mailing list