[vlc-devel] [PATCH 14/29] qml: add setCurrentItemFocus function to ExpandGridView

Prince Gupta guptaprince8832 at gmail.com
Tue Aug 4 13:34:47 CEST 2020


---
 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
-- 
2.25.1



More information about the vlc-devel mailing list