[vlc-commits] qml: ensure sibiling widget exist before navigating to them in VolumeWidget

Pierre Lamot git at videolan.org
Thu Aug 29 10:44:49 CEST 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Fri Aug  2 11:02:36 2019 +0200| [bf1ef67b0faad1795c986b2ae3baae9b22102086] | committer: Jean-Baptiste Kempf

qml: ensure sibiling widget exist before navigating to them in VolumeWidget

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

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

diff --git a/modules/gui/qt/qml/player/VolumeWidget.qml b/modules/gui/qt/qml/player/VolumeWidget.qml
index a4340e1236..59810fb439 100644
--- a/modules/gui/qt/qml/player/VolumeWidget.qml
+++ b/modules/gui/qt/qml/player/VolumeWidget.qml
@@ -74,8 +74,22 @@ FocusScope{
             Keys.onSpacePressed: player.muted = !player.muted
             Keys.onUpPressed: volControl.increase()
             Keys.onDownPressed: volControl.decrease()
-            Keys.onRightPressed: widgetfscope.KeyNavigation.right.forceActiveFocus()
-            Keys.onLeftPressed: widgetfscope.KeyNavigation.left.forceActiveFocus()
+            Keys.onRightPressed: {
+                var right = widgetfscope.KeyNavigation.right
+                while (right && (!right.enabled || !right.visible)) {
+                    right = right.KeyNavigation ? right.KeyNavigation.left : undefined
+                }
+                if (right)
+                    right.forceActiveFocus()
+            }
+            Keys.onLeftPressed: {
+                var left = widgetfscope.KeyNavigation.left
+                while (left && (!left.enabled || !left.visible)) {
+                    left = left.KeyNavigation ? left.KeyNavigation.left : undefined
+                }
+                if (left)
+                    left.forceActiveFocus()
+            }
 
             property color sliderColor: (volControl.position > fullvolpos) ? VLCStyle.colors.volmax : widgetfscope.color
             property int maxvol: 125



More information about the vlc-commits mailing list