[vlc-commits] qml: add footer property in ExpandGridView

Prince Gupta git at videolan.org
Fri Nov 27 14:52:30 CET 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Fri Nov 20 23:26:51 2020 +0530| [ef13942e0e79af1e464c877bdcdeaa64981ca61e] | committer: Pierre Lamot

qml: add footer property in ExpandGridView

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

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

diff --git a/modules/gui/qt/widgets/qml/ExpandGridView.qml b/modules/gui/qt/widgets/qml/ExpandGridView.qml
index 21f484f1e5..1ec1e8aac1 100644
--- a/modules/gui/qt/widgets/qml/ExpandGridView.qml
+++ b/modules/gui/qt/widgets/qml/ExpandGridView.qml
@@ -75,6 +75,9 @@ NavigableFocusScope {
     property int headerHeight: headerItemLoader.implicitHeight
     property alias headerItem: headerItemLoader.item
 
+    property alias footerItem: footerItemLoader.item
+    property alias footerDelegate: footerItemLoader.sourceComponent
+
     //signals emitted when selected items is updated from keyboard
     signal selectionUpdated( int keyModifiers, int oldIndex,int newIndex )
     signal selectAll()
@@ -356,6 +359,21 @@ NavigableFocusScope {
             }
         }
 
+        Loader {
+            id: footerItemLoader
+            focus: item.focus
+            y: root.topMargin + root.headerHeight + (root._effectiveCellHeight * (Math.ceil(model.count / getNbItemsPerRow()))) +
+               _expandItemVerticalSpace
+        }
+
+        Connections {
+            target: footerItem
+            onHeightChanged: {
+                if (flickable.contentY + flickable.height > footerItemLoader.y + footerItemLoader.height)
+                    flickable.contentY = footerItemLoader.y + footerItemLoader.height - flickable.height
+                flickable.layout(false)
+            }
+        }
 
         Loader {
             id: expandItemLoader
@@ -444,6 +462,7 @@ NavigableFocusScope {
             // Calculate and set the contentHeight
             var newContentHeight = root.getItemPos(_count - 1)[1] + root._effectiveCellHeight + _expandItemVerticalSpace
             contentHeight = newContentHeight + root.bottomMargin // topMargin is included from root.getItemPos
+            contentHeight += footerItemLoader.item ? footerItemLoader.item.height : 0
             contentWidth = root._effectiveCellWidth * root.getNbItemsPerRow() - root.horizontalSpacing
 
             _updateSelected()



More information about the vlc-commits mailing list