[vlc-commits] qml: refactor navigation by setting default navigation parent

Pierre Lamot git at videolan.org
Fri Sep 6 18:02:10 CEST 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Fri Sep  6 16:38:33 2019 +0200| [00ea363cf131b9b7d3997feb1057ea6870011904] | committer: Jean-Baptiste Kempf

qml: refactor navigation by setting default navigation parent

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

 modules/gui/qt/qml/mediacenter/MCMainDisplay.qml   | 15 +++-----
 modules/gui/qt/qml/mediacenter/MCMusicDisplay.qml  | 10 ++---
 .../gui/qt/qml/mediacenter/MCNetworkDisplay.qml    | 43 +++++++++-------------
 .../mediacenter/MCNetworksSectionSelectableDM.qml  |  4 +-
 modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml  |  8 ++--
 .../gui/qt/qml/mediacenter/MCVideoListDisplay.qml  | 18 ++++++---
 .../gui/qt/qml/mediacenter/MusicAlbumsDisplay.qml  | 22 ++++-------
 .../mediacenter/MusicAlbumsGridExpandDelegate.qml  |  7 +---
 .../gui/qt/qml/mediacenter/MusicArtistsDisplay.qml | 14 ++-----
 .../gui/qt/qml/mediacenter/MusicGenresDisplay.qml  | 12 +-----
 modules/gui/qt/qml/player/ControlBar.qml           |  9 ++---
 modules/gui/qt/qml/player/MiniPlayer.qml           |  7 +---
 modules/gui/qt/qml/player/ModalControlBar.qml      | 13 ++-----
 modules/gui/qt/qml/player/Player.qml               | 14 ++-----
 modules/gui/qt/qml/player/TrackSelector.qml        |  2 +-
 modules/gui/qt/qml/playlist/PlaylistListView.qml   | 16 ++++----
 modules/gui/qt/qml/utils/KeyNavigableListView.qml  |  8 ++--
 modules/gui/qt/qml/utils/KeyNavigableTableView.qml |  7 +---
 modules/gui/qt/qml/utils/ListItem.qml              |  6 +--
 19 files changed, 93 insertions(+), 142 deletions(-)

diff --git a/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml b/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
index 5500142a19..3b7a119c78 100644
--- a/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
@@ -138,11 +138,8 @@ Utils.NavigableFocusScope {
                         contentModel = stackView.currentItem.contentModel
                     }
 
-                    onActionDown: stackView.focus = true
-                    onActionLeft: root.actionLeft(index)
-                    onActionRight: root.actionRight(index)
-                    onActionUp: root.actionUp(index)
-                    onActionCancel: root.actionCancel(index)
+                    navigationParent: root
+                    navigationDown: function() { stackView.focus = true }
                 }
 
                 Item {
@@ -255,7 +252,7 @@ Utils.NavigableFocusScope {
 
                     onActionUp: stackView.focus = true
                     onActionCancel: sourcesBanner.focus = true
-                    onActionDown: medialibId.actionDown(index)
+                    onActionDown: medialibId.navigationDown(index)
                 }
             }
 
@@ -265,13 +262,13 @@ Utils.NavigableFocusScope {
 
                 onActionUp: sourcesBanner.focus = true
                 onActionCancel: stackViewZone.focus = true
-                onActionLeft: medialibId.actionLeft(index)
-                onActionRight: medialibId.actionRight(index)
+                onActionLeft: medialibId.navigationLeft(index)
+                onActionRight: medialibId.navigationRight(index)
                 onActionDown: {
                     if (miniPlayer.expanded)
                         miniPlayer.focus = true
                     else
-                        medialibId.actionDown(index)
+                        medialibId.navigationDown(index)
                 }
             }
 
diff --git a/modules/gui/qt/qml/mediacenter/MCMusicDisplay.qml b/modules/gui/qt/qml/mediacenter/MCMusicDisplay.qml
index 49fa5ced8e..6a7eb0004b 100644
--- a/modules/gui/qt/qml/mediacenter/MCMusicDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCMusicDisplay.qml
@@ -104,11 +104,11 @@ Utils.NavigableFocusScope {
         Connections {
             target: stackView.currentItem
             ignoreUnknownSignals: true
-            onActionLeft:   root.actionLeft(index)
-            onActionRight:  root.actionRight(index)
-            onActionDown:   root.actionDown(index)
-            onActionUp:     root.actionUp(index)
-            onActionCancel: root.actionCancel(index)
+            onActionLeft:   root.navigationLeft(index)
+            onActionRight:  root.navigationRight(index)
+            onActionDown:   root.navigationDown(index)
+            onActionUp:     root.navigationUp(index)
+            onActionCancel: root.navigationCancel(index)
         }
     }
 }
diff --git a/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml b/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
index 1815c1c2b6..a27d5b56a5 100644
--- a/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCNetworkDisplay.qml
@@ -174,11 +174,13 @@ Utils.NavigableFocusScope {
                         onSelectionUpdated:  machineDM.updateSelection( keyModifiers, oldIndex, newIndex )
                         onActionAtIndex: machineDM.actionAtIndex(index)
 
-                        onActionLeft: topFocusScope.actionLeft(index)
-                        onActionRight: topFocusScope.actionRight(index)
-                        onActionUp:  topFocusScope.actionUp(index)
-                        onActionDown: if (lanSection.visible) lanSection.focus = true; else topFocusScope.actionDown(index);
-                        onActionCancel: topFocusScope.actionCancel(index)
+                        navigationParent: topFocusScope
+                        navigationDown: function (index) {
+                            if (lanSection.visible)
+                                lanSection.focus = true;
+                            else
+                                topFocusScope.navigationDown(index);
+                        }
                     }
 
                     Utils.LabelSeparator {
@@ -204,21 +206,20 @@ Utils.NavigableFocusScope {
                         onSelectionUpdated:  lanDM.updateSelection( keyModifiers, oldIndex, newIndex )
                         onActionAtIndex: lanDM.actionAtIndex(index)
 
-                        onActionLeft: topFocusScope.actionLeft(index)
-                        onActionRight: topFocusScope.actionRight(index)
-                        onActionUp: if (deviceSection.visible) deviceSection.focus = true; else topFocusScope.actionUp(index);
-                        onActionDown: topFocusScope.actionDown(index)
-                        onActionCancel: topFocusScope.actionCancel(index)
+
+                        navigationParent: topFocusScope
+                        navigationUp: function (index) {
+                            if (deviceSection.visible)
+                                deviceSection.focus = true;
+                            else
+                                topFocusScope.navigationUp(index);
+                        }
                     }
                 }
 
             }
 
-            onActionLeft: root.actionLeft(index)
-            onActionRight: root.actionRight(index)
-            onActionUp:  root.actionUp(index)
-            onActionDown: root.actionDown(index)
-            onActionCancel: root.actionCancel(index)
+            navigationParent: root
 
             onActiveFocusChanged: {
                 if (!deviceSection.focus && !lanSection.focus) {
@@ -253,11 +254,7 @@ Utils.NavigableFocusScope {
            onSelectionUpdated:  delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
            onActionAtIndex: delegateModel.actionAtIndex(index)
 
-           onActionLeft: root.actionLeft(index)
-           onActionRight: root.actionRight(index)
-           onActionUp: root.actionUp(index)
-           onActionDown: root.actionDown(index)
-           onActionCancel: root.actionCancel(index)
+           navigationParent: root
        }
    }
 
@@ -277,11 +274,7 @@ Utils.NavigableFocusScope {
            onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
            onActionAtIndex: delegateModel.actionAtIndex(index)
 
-           onActionLeft: root.actionLeft(index)
-           onActionRight: root.actionRight(index)
-           onActionDown: root.actionDown(index)
-           onActionUp: root.actionUp(index)
-           onActionCancel: root.actionCancel(index)
+           navigationParent: root
        }
    }
 
diff --git a/modules/gui/qt/qml/mediacenter/MCNetworksSectionSelectableDM.qml b/modules/gui/qt/qml/mediacenter/MCNetworksSectionSelectableDM.qml
index a113eb01d2..2fb1deb456 100644
--- a/modules/gui/qt/qml/mediacenter/MCNetworksSectionSelectableDM.qml
+++ b/modules/gui/qt/qml/mediacenter/MCNetworksSectionSelectableDM.qml
@@ -50,8 +50,8 @@ Utils.SelectableDelegateModel {
         }
         Connections {
             target: delegateLoader.item
-            onActionLeft: root.actionLeft(0)
-            onActionRight: root.actionRight(0)
+            onActionLeft: root.navigationLeft(0)
+            onActionRight: root.navigationRight(0)
         }
 
     }
diff --git a/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml b/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml
index e34ce3a213..d65a04c21f 100644
--- a/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCVideoDisplay.qml
@@ -139,11 +139,7 @@ Utils.NavigableFocusScope {
                             }
                         }
 
-                        onActionLeft: root.actionLeft(index)
-                        onActionRight: root.actionRight(index)
-                        onActionDown: root.actionDown(index)
-                        onActionUp: root.actionUp(index)
-                        onActionCancel: root.actionCancel(index)
+                        navigationParent: root
 
                         /*
                          *define the intial position/selection
@@ -174,6 +170,8 @@ Utils.NavigableFocusScope {
                 contextMenu.model = menuModel
                 contextMenu.popup(menuParent)
             }
+
+            navigationParent: root
         }
     }
 
diff --git a/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml b/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml
index 6094419403..63689f5f80 100644
--- a/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml
@@ -141,10 +141,16 @@ Utils.KeyNavigableTableView {
         }
         medialib.addAndPlay(list)
     }
-    onActionLeft:  isFocusOnContextButton ? isFocusOnContextButton = false : root.actionLeft(index)
-    onActionRight: !isFocusOnContextButton ? isFocusOnContextButton = true : root.actionRight(index)
-    onActionDown:   root.actionDown(index)
-    onActionUp:     root.actionUp(index)
-    onActionCancel: root.actionCancel(index)
-
+    navigationLeft:  function(index) {
+        if (isFocusOnContextButton )
+            isFocusOnContextButton = false
+        else
+            defaultNavigationLeft(index)
+    }
+    navigationRight: function(index) {
+        if (!isFocusOnContextButton)
+            isFocusOnContextButton = true
+        else
+            defaultNavigationRight(index)
+    }
 }
diff --git a/modules/gui/qt/qml/mediacenter/MusicAlbumsDisplay.qml b/modules/gui/qt/qml/mediacenter/MusicAlbumsDisplay.qml
index 0038ff8d1c..99aaeccc19 100644
--- a/modules/gui/qt/qml/mediacenter/MusicAlbumsDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MusicAlbumsDisplay.qml
@@ -134,10 +134,12 @@ Utils.NavigableFocusScope {
             expandDelegate: MusicAlbumsGridExpandDelegate {
                 id: expandDelegateId
                 width: root.width
-                onActionCancel:  gridView_id.retract()
-                onActionUp:  gridView_id.retract()
-                onActionLeft: root.actionLeft(index)
-                onActionRight: root.actionRight(index)
+
+                navigationParent: root
+                navigationCancel:  function() {  gridView_id.retract() }
+                navigationUp: function() {  gridView_id.retract() }
+                navigationDown: function() {}
+
             }
 
             model: delegateModel
@@ -153,11 +155,7 @@ Utils.NavigableFocusScope {
             onSelectAll: delegateModel.selectAll()
             onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
 
-            onActionLeft: root.actionLeft(index)
-            onActionRight: root.actionRight(index)
-            onActionDown: root.actionDown(index)
-            onActionUp: root.actionUp(index)
-            onActionCancel: root.actionCancel(index)
+            navigationParent: root
         }
     }
 
@@ -180,11 +178,7 @@ Utils.NavigableFocusScope {
             onSelectAll: delegateModel.selectAll()
             onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
 
-            onActionLeft: root.actionLeft(index)
-            onActionRight: root.actionRight(index)
-            onActionDown: root.actionDown(index)
-            onActionUp: root.actionUp(index)
-            onActionCancel: root.actionCancel(index)
+            navigationParent: root
         }
     }
 
diff --git a/modules/gui/qt/qml/mediacenter/MusicAlbumsGridExpandDelegate.qml b/modules/gui/qt/qml/mediacenter/MusicAlbumsGridExpandDelegate.qml
index dd2ae60b57..cc2f36a050 100644
--- a/modules/gui/qt/qml/mediacenter/MusicAlbumsGridExpandDelegate.qml
+++ b/modules/gui/qt/qml/mediacenter/MusicAlbumsGridExpandDelegate.qml
@@ -208,11 +208,8 @@ Utils.NavigableFocusScope {
                 }
                 focus: true
 
-                onActionLeft:  playButton.forceActiveFocus()
-                onActionRight: root.actionRight(index)
-                onActionUp: root.actionUp(index)
-                onActionDown: root.actionDown(index)
-                onActionCancel: root.actionCancel(index)
+                navigationParent: root
+                navigationLeft: function() { playButton.forceActiveFocus() }
             }
 
             Item {
diff --git a/modules/gui/qt/qml/mediacenter/MusicArtistsDisplay.qml b/modules/gui/qt/qml/mediacenter/MusicArtistsDisplay.qml
index 8171593fb2..7ab8290536 100644
--- a/modules/gui/qt/qml/mediacenter/MusicArtistsDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MusicArtistsDisplay.qml
@@ -129,11 +129,8 @@ Utils.NavigableFocusScope {
             onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
             onCurrentIndexChanged: delegateModel.actionAtIndex(currentIndex)
 
-            onActionRight: view.focus = true
-            onActionLeft: root.actionLeft(index)
-            onActionUp: root.actionUp(index)
-            onActionDown: root.actionDown(index)
-            onActionCancel: root.actionCancel(index)
+            navigationParent: root
+            navigationRight: function () { view.focus = true }
         }
 
         FocusScope {
@@ -158,12 +155,9 @@ Utils.NavigableFocusScope {
 
                 focus: true
                 parentId: artistId
-                onActionLeft: artistList.focus = true
 
-                onActionRight: root.actionRight(index)
-                onActionUp: root.actionUp(index)
-                onActionDown: root.actionDown(index)
-                onActionCancel: root.actionCancel(index)
+                navigationParent: root
+                navigationLeft: function () { artistList.focus = true }
             }
 
         }
diff --git a/modules/gui/qt/qml/mediacenter/MusicGenresDisplay.qml b/modules/gui/qt/qml/mediacenter/MusicGenresDisplay.qml
index 74a4268a57..8a1fc52528 100644
--- a/modules/gui/qt/qml/mediacenter/MusicGenresDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MusicGenresDisplay.qml
@@ -163,11 +163,7 @@ Utils.NavigableFocusScope {
             onSelectionUpdated:  delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
             onActionAtIndex: delegateModel.actionAtIndex(index)
 
-            onActionLeft: root.actionLeft(index)
-            onActionRight: root.actionRight(index)
-            onActionUp: root.actionUp(index)
-            onActionDown: root.actionDown(index)
-            onActionCancel: root.actionCancel(index)
+            navigationParent: root
         }
     }
 
@@ -187,11 +183,7 @@ Utils.NavigableFocusScope {
             onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
             onActionAtIndex: delegateModel.actionAtIndex(index)
 
-            onActionLeft: root.actionLeft(index)
-            onActionRight: root.actionRight(index)
-            onActionUp: root.actionUp(index)
-            onActionDown: root.actionDown(index)
-            onActionCancel: root.actionCancel(index)
+            navigationParent: root
         }
     }
 
diff --git a/modules/gui/qt/qml/player/ControlBar.qml b/modules/gui/qt/qml/player/ControlBar.qml
index 7921a914a1..860654a610 100644
--- a/modules/gui/qt/qml/player/ControlBar.qml
+++ b/modules/gui/qt/qml/player/ControlBar.qml
@@ -96,17 +96,14 @@ Utils.NavigableFocusScope {
 
             focus: true
 
-            onActionUp: {
+            navigationParent: root
+            navigationUp: function(index) {
                 if (trackPositionSlider.enabled)
                     trackPositionSlider.focus = true
                 else
-                    root.actionUp(index)
+                    root.navigationUp(index)
             }
 
-            onActionDown: root.actionDown(index)
-            onActionLeft: root.actionLeft(index)
-            onActionRight: root.actionRight(index)
-            onActionCancel: root.actionCancel(index)
 
             Keys.priority: Keys.AfterItem
             Keys.onPressed: defaultKeyAction(event, 0)
diff --git a/modules/gui/qt/qml/player/MiniPlayer.qml b/modules/gui/qt/qml/player/MiniPlayer.qml
index de3c651fe4..585c7b0de6 100644
--- a/modules/gui/qt/qml/player/MiniPlayer.qml
+++ b/modules/gui/qt/qml/player/MiniPlayer.qml
@@ -138,11 +138,8 @@ Utils.NavigableFocusScope {
                 Layout.preferredWidth: buttonrow.implicitWidth
                 Layout.preferredHeight: buttonrow.implicitHeight
 
-                onActionUp: root.actionUp(index)
-                onActionDown: root.actionDown(index)
-                onActionLeft: playingItemInfo.forceActiveFocus()
-                onActionRight: root.actionRight(index)
-                onActionCancel: root.actionCancel(index)
+                navigationParent: root
+                navigationLeft: function() {  playingItemInfo.forceActiveFocus() }
             }
         }
 
diff --git a/modules/gui/qt/qml/player/ModalControlBar.qml b/modules/gui/qt/qml/player/ModalControlBar.qml
index cce8baf94d..13eb048062 100644
--- a/modules/gui/qt/qml/player/ModalControlBar.qml
+++ b/modules/gui/qt/qml/player/ModalControlBar.qml
@@ -36,11 +36,7 @@ Utils.NavigableFocusScope {
 
             onShowTrackBar: root.state = "tracks"
 
-            onActionUp: root.actionUp(index)
-            onActionDown: root.actionDown(index)
-            onActionLeft: root.actionLeft(index)
-            onActionRight: root.actionRight(index)
-            onActionCancel: root.actionCancel(index)
+            navigationParent: root
         }
     }
 
@@ -48,12 +44,9 @@ Utils.NavigableFocusScope {
         id: trackbarComp_id
         TrackSelector {
             focus: true
-            onActionCancel:  root.state = "control"
 
-            onActionUp: root.actionUp(index)
-            onActionDown: root.actionDown(index)
-            onActionLeft: root.actionLeft(index)
-            onActionRight: root.actionRight(index)
+            navigationParent: root
+            navigationCancel: function() { root.state = "control" }
         }
     }
 
diff --git a/modules/gui/qt/qml/player/Player.qml b/modules/gui/qt/qml/player/Player.qml
index 84d0de7612..d4f6423450 100644
--- a/modules/gui/qt/qml/player/Player.qml
+++ b/modules/gui/qt/qml/player/Player.qml
@@ -159,11 +159,8 @@ Utils.NavigableFocusScope {
                     toolbarAutoHide.restart()
             }
 
-            onActionDown: controlBarView.forceActiveFocus()
-            onActionUp: rootPlayer.actionUp(index)
-            onActionLeft: rootPlayer.actionLeft(index)
-            onActionRight: rootPlayer.actionRight(index)
-            onActionCancel: rootPlayer.actionCancel(index)
+            navigationParent: rootPlayer
+            navigationDown: function () { controlBarView.forceActiveFocus() }
 
             Keys.onPressed: {
                 if (event.accepted)
@@ -262,11 +259,8 @@ Utils.NavigableFocusScope {
                             toolbarAutoHide.restart()
                     }
 
-                    onActionUp: topcontrolView.forceActiveFocus()
-                    onActionDown: rootPlayer.actionDown(index)
-                    onActionLeft: rootPlayer.actionLeft(index)
-                    onActionRight: rootPlayer.actionRight(index)
-                    onActionCancel: rootPlayer.actionCancel(index)
+                    navigationParent: rootPlayer
+                    navigationUp: function() { topcontrolView.forceActiveFocus() }
 
                     //unhandled keys are forwarded as hotkeys
                     Keys.onPressed: {
diff --git a/modules/gui/qt/qml/player/TrackSelector.qml b/modules/gui/qt/qml/player/TrackSelector.qml
index bd017dc106..15df240b27 100644
--- a/modules/gui/qt/qml/player/TrackSelector.qml
+++ b/modules/gui/qt/qml/player/TrackSelector.qml
@@ -72,7 +72,7 @@ Utils.NavigableFocusScope {
         anchors.verticalCenter: parent.verticalCenter
         size: VLCStyle.icon_large
         text: VLCIcons.exit
-        onClicked: root.actionCancel(0)
+        onClicked: root.navigationCancel(0)
         KeyNavigation.right: trackTypeTumbler
     }
 
diff --git a/modules/gui/qt/qml/playlist/PlaylistListView.qml b/modules/gui/qt/qml/playlist/PlaylistListView.qml
index ae34af5e5b..90c13ca9aa 100644
--- a/modules/gui/qt/qml/playlist/PlaylistListView.qml
+++ b/modules/gui/qt/qml/playlist/PlaylistListView.qml
@@ -158,29 +158,31 @@ Utils.NavigableFocusScope {
                 updateSelection(keyModifiers, oldIndex, newIndex);
             }
         }
+
         Keys.onDeletePressed: onDelete()
-        onActionRight: {
+
+        navigationParent: root
+        navigationRight: function() {
             overlay.state = "normal"
             overlay.focus = true
         }
-        onActionLeft: {
+        navigationLeft: function(index) {
             if (mode === "normal") {
-                root.actionLeft(index)
+                root.navigationLeft(index)
             } else {
                 overlay.state = "hidden"
                 mode = "normal"
             }
         }
-        onActionCancel: {
+        navigationCancel: function(index) {
             if (mode === "normal") {
-                root.actionCancel(index)
+                root.navigationCancel(index)
             } else {
                 overlay.state = "hidden"
                 mode = "normal"
             }
         }
-        onActionUp: root.actionUp(index)
-        onActionDown: root.actionDown(index)
+
         onActionAtIndex: {
             if (mode === "select")
                 root.plmodel.toggleSelected(index)
diff --git a/modules/gui/qt/qml/utils/KeyNavigableListView.qml b/modules/gui/qt/qml/utils/KeyNavigableListView.qml
index fc6f0805a0..475af5457a 100644
--- a/modules/gui/qt/qml/utils/KeyNavigableListView.qml
+++ b/modules/gui/qt/qml/utils/KeyNavigableListView.qml
@@ -108,8 +108,8 @@ NavigableFocusScope {
         Connections {
             target: view.currentItem
             ignoreUnknownSignals: true
-            onActionRight: listview_id.actionRight(currentIndex)
-            onActionLeft: listview_id.actionLeft(currentIndex)
+            onActionRight: listview_id.navigationRight(currentIndex)
+            onActionLeft: listview_id.navigationLeft(currentIndex)
             onActionDown: {
                 if ( currentIndex !== modelCount - 1 ) {
                     var newIndex = currentIndex + 1
@@ -117,7 +117,7 @@ NavigableFocusScope {
                     currentIndex = newIndex
                     selectionUpdated(0, oldIndex, newIndex)
                 } else {
-                    root.actionDown(currentIndex)
+                    root.navigationDown(currentIndex)
                 }
             }
             onActionUp: {
@@ -127,7 +127,7 @@ NavigableFocusScope {
                     currentIndex = newIndex
                     selectionUpdated(0, oldIndex, newIndex)
                 } else {
-                    root.actionUp(currentIndex)
+                    root.navigationUp(currentIndex)
                 }
             }
         }
diff --git a/modules/gui/qt/qml/utils/KeyNavigableTableView.qml b/modules/gui/qt/qml/utils/KeyNavigableTableView.qml
index 523265d6f6..881881a8ea 100644
--- a/modules/gui/qt/qml/utils/KeyNavigableTableView.qml
+++ b/modules/gui/qt/qml/utils/KeyNavigableTableView.qml
@@ -217,12 +217,9 @@ NavigableFocusScope {
 
         onSelectAll: delegateModel.selectAll()
         onSelectionUpdated: delegateModel.updateSelection( keyModifiers, oldIndex, newIndex )
-        onActionLeft: root.actionLeft(index)
-        onActionRight: root.actionRight(index)
-        onActionUp: root.actionUp(index)
-        onActionDown: root.actionDown(index)
-        onActionCancel: root.actionCancel(index)
         onActionAtIndex: root.actionForSelection( delegateModel.selectedGroup )
+
+        navigationParent: root
     }
 
     /*
diff --git a/modules/gui/qt/qml/utils/ListItem.qml b/modules/gui/qt/qml/utils/ListItem.qml
index 4ba18ad8f6..e2bebdc680 100644
--- a/modules/gui/qt/qml/utils/ListItem.qml
+++ b/modules/gui/qt/qml/utils/ListItem.qml
@@ -163,12 +163,12 @@ NavigableFocusScope {
 
                 Keys.onRightPressed: {
                     if (actionButtons.length === 0 && !root.showContextButton)
-                        root.actionRight(0)
+                        root.navigationRight(0)
                     else
                         toolButtons.focus = true
                 }
                 Keys.onLeftPressed: {
-                    root.actionLeft(0)
+                    root.navigationLeft(0)
                 }
             }
 
@@ -211,7 +211,7 @@ NavigableFocusScope {
                 }
                 Keys.onRightPressed: {
                if (toolButtons.focusIndex === (actionButtons.length - (!root.showContextButton ? 1 : 0) ) )
-                        root.actionRight(0)
+                        root.navigationRight(0)
                     else {
                         toolButtons.focusIndex += 1
                     }



More information about the vlc-commits mailing list