[vlc-commits] qml: fix nagivation of PlayerButtonLayout

Pierre Lamot git at videolan.org
Thu Aug 29 10:45:15 CEST 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Thu Aug 29 09:46:37 2019 +0200| [38215f577515ee5704cdb2e2b3d43e59ef3ad7e9] | committer: Jean-Baptiste Kempf

qml: fix nagivation of PlayerButtonLayout

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

 modules/gui/qt/qml/player/PlayerButtonsLayout.qml | 32 ++++++++++++-----------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/modules/gui/qt/qml/player/PlayerButtonsLayout.qml b/modules/gui/qt/qml/player/PlayerButtonsLayout.qml
index e75b0b4f62..4fbe96b875 100644
--- a/modules/gui/qt/qml/player/PlayerButtonsLayout.qml
+++ b/modules/gui/qt/qml/player/PlayerButtonsLayout.qml
@@ -49,28 +49,30 @@ RowLayout{
 
     Repeater{
         id: buttonsRepeater
+
+        onItemRemoved: {
+            if (item.focus) {
+                buttonrow._focusGiven = false
+            }
+        }
+
         delegate: Loader{
             id: buttonloader
 
             sourceComponent: controlmodelbuttons.returnbuttondelegate(model.id)
             onLoaded: {
-                if (! buttonloader.item.acceptFocus)
-                    return
-                else
-                    if (!buttonrow._focusGiven){
-                        buttonloader.item.focus = true
-                        buttonrow._focusGiven = true
-                    }
+                if (!buttonrow._focusGiven) {
+                    buttonloader.focus = true
+                    buttonrow._focusGiven = true
+                }
+                buttonloader.item.focus = true
+
                 if(buttonloader.item instanceof Utils.IconToolButton)
                     buttonloader.item.size = model.size === PlayerControlBarModel.WIDGET_BIG ?
-                                VLCStyle.icon_large : defaultSize
-
-                var buttonindex = DelegateModel.itemsIndex
-                while(buttonindex > 0 && !(buttonrow.children[buttonindex-1].item.acceptFocus))
-                    buttonindex = buttonindex-1
+                                VLCStyle.icon_large : playerButtonsLayout.defaultSize
 
                 //force buttons color
-                if (buttonrow.forceColors) {
+                if (playerButtonsLayout.forceColors) {
                     if ( buttonloader.item.color )
                         buttonloader.item.color = VLCStyle.colors.playerFg
                     if ( buttonloader.item.bgColor )
@@ -79,8 +81,8 @@ RowLayout{
                         buttonloader.item.borderColor = VLCStyle.colors.playerBorder
                 }
 
-                if (buttonindex > 0)
-                    buttonloader.item.KeyNavigation.left = buttonrow.children[buttonindex-1].item
+                if (index > 0)
+                    buttonloader.item.KeyNavigation.left = buttonrow.children[index-1].item
             }
         }
     }



More information about the vlc-commits mailing list