[vlc-devel] [PATCH 10/14] qml: set the initial focus when the delegate model of NetworkBrowseDisplay is populated

Pierre Lamot pierre at videolabs.io
Thu Feb 6 13:56:47 CET 2020


  Reseting the focus on active focus wasn't suffisant because the
  view (hence the focus) no longer reloaded when navigating.

  We now set the initial focus when the delegate model is populated.
---
 modules/gui/qt/network/qml/NetworkBrowseDisplay.qml | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml b/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
index 62c2807260..08c7fa09ce 100644
--- a/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
+++ b/modules/gui/qt/network/qml/NetworkBrowseDisplay.qml
@@ -41,14 +41,10 @@ Widgets.NavigableFocusScope {
     NetworksSectionSelectableDM{
         id: delegateModel
         model: providerModel
+        onCountChanged: resetFocus()
     }
 
-    /*
-     *define the intial position/selection
-     * This is done on activeFocus rather than Component.onCompleted because delegateModel.
-     * selectedGroup update itself after this event
-     */
-    onActiveFocusChanged: {
+    function resetFocus() {
         if (delegateModel.items.count > 0 && delegateModel.selectedGroup.count === 0) {
             var initialIndex = 0
             if (delegateModel.currentIndex !== -1)
-- 
2.17.1



More information about the vlc-devel mailing list