[vlc-commits] qml: set the initial focus when the delegate model of NetworkBrowseDisplay is populated

Pierre Lamot git at videolan.org
Thu Feb 13 11:06:42 CET 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Jan 28 10:12:56 2020 +0100| [06f47c966af5729dd31d69dc4cc47e66486f6cbf] | committer: Jean-Baptiste Kempf

qml: set the initial focus when the delegate model of NetworkBrowseDisplay is populated

  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.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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)



More information about the vlc-commits mailing list