[vlc-commits] [Git][videolan/vlc][master] qml/ExpandGridView: Set content size via property binding

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Mar 27 11:39:06 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
37ffd8bb by Benjamin Arnaud at 2023-03-27T11:21:07+00:00
qml/ExpandGridView: Set content size via property binding

This fixes a bug when the contentHeight is binded to the height and the model has
content prior to the Component.onCompleted event being called. This happens in
BrowseHomeDisplay with the StandardPathModel: without these updated conditions the
contentHeight will never be updated.

Co-authored-by: Prince Gupta <guptaprince8832 at gmail.com>

- - - - -


1 changed file:

- modules/gui/qt/widgets/qml/ExpandGridView.qml


Changes:

=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -122,6 +122,22 @@ FocusScope {
 
     // Settings
 
+    contentWidth: {
+        var size = _effectiveCellWidth * nbItemPerRow - horizontalSpacing
+
+        return leftMargin + size + rightMargin
+    }
+
+    contentHeight: {
+        var size = getItemPos(_count - 1)[1] + rowHeight + _expandItemVerticalSpace
+
+        // NOTE: topMargin and headerHeight are included in root.getItemPos.
+        if (footerItem)
+            return size + footerItem.height + bottomMargin
+        else
+            return size + bottomMargin
+    }
+
     Accessible.role: Accessible.Table
 
     activeFocusOnTab: true
@@ -776,15 +792,6 @@ FocusScope {
 
             // Place the delegates after the expandItem
             _setupIndexes(forceRelayout, [topGridEndId, lastId], root._expandItemVerticalSpace)
-
-            // update contentWidth and contentHeight
-            var gridContentWidth = root._effectiveCellWidth * root.nbItemPerRow - root.horizontalSpacing
-            contentWidth = root.leftMargin + gridContentWidth + root.rightMargin
-
-            var gridContentHeight = root.getItemPos(root._count - 1)[1] + root.rowHeight + root._expandItemVerticalSpace
-            contentHeight = gridContentHeight
-                    + (footerItemLoader.item ? footerItemLoader.item.height : 0)
-                    + root.bottomMargin // topMargin and headerHeight is included in root.getItemPos
         }
 
         Connections {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/37ffd8bb088aced6f884a6a0481df2e073e24987

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/37ffd8bb088aced6f884a6a0481df2e073e24987
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list