[vlc-commits] qml: add setCurrentItemFocus function to ExpandGridView

Prince Gupta git at videolan.org
Mon Aug 10 12:09:38 CEST 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Tue Aug  4 12:56:37 2020 +0530| [4d6db2611704e70586e776fb1962eb225824b8d4] | committer: Pierre Lamot

qml: add setCurrentItemFocus function to ExpandGridView

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

 modules/gui/qt/widgets/qml/ExpandGridView.qml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/modules/gui/qt/widgets/qml/ExpandGridView.qml b/modules/gui/qt/widgets/qml/ExpandGridView.qml
index a4e575e7e0..12cea86073 100644
--- a/modules/gui/qt/widgets/qml/ExpandGridView.qml
+++ b/modules/gui/qt/widgets/qml/ExpandGridView.qml
@@ -84,6 +84,13 @@ NavigableFocusScope {
 
     Accessible.role: Accessible.Table
 
+    function setCurrentItemFocus() {
+        if (!model || model.count === 0 || currentIndex === -1)
+            return
+        positionViewAtIndex(currentIndex, ItemView.Contain)
+        flickable.setCurrentItemFocus()
+    }
+
     function switchExpandItem(index) {
         if (_count === 0)
             return



More information about the vlc-commits mailing list