[vlc-commits] [Git][videolan/vlc][master] qml/ExpandGridView: Do not force header on the first row

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Fri Jun 17 14:46:45 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
19364a7b by Benjamin Arnaud at 2022-06-17T14:17:08+00:00
qml/ExpandGridView: Do not force header on the first row

fix #26273

- - - - -


1 changed file:

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


Changes:

=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -344,17 +344,10 @@ FocusScope {
     //use the same signature as Gridview.positionViewAtIndex(index, PositionMode mode)
     //mode is ignored at the moment
     function positionViewAtIndex(index, mode) {
-        if (flickable.width === 0 || flickable.height === 0)
-            return
-
-        if (index <= 0) {
-            animateFlickableContentY(0)
+        if (flickable.width === 0 || flickable.height === 0
+            ||
+            index < 0 || index >= _count)
             return
-        } else if (index >= _count) {
-            return
-        }
-
-        var newContentY = flickable.contentY
 
         var itemTopY = getItemPos(index)[1]
         var itemBottomY = itemTopY + _effectiveCellHeight
@@ -362,16 +355,16 @@ FocusScope {
         var viewTopY = flickable.contentY
         var viewBottomY = viewTopY + flickable.height
 
-        if (index < _nbItemPerRow) {
-            //force to see the header when on the first row
-            newContentY = 0
-        } else if ( itemTopY < viewTopY ) {
-            //item above view
+        var newContentY
+
+        if (itemTopY < viewTopY)
+             //item above view
             newContentY = itemTopY - topMargin
-        } else if (itemBottomY > viewBottomY) {
-            //item below view
+        else if (itemBottomY > viewBottomY)
+             //item below view
             newContentY = itemBottomY + bottomMargin - flickable.height
-        }
+        else
+            newContentY = flickable.contentY
 
         if (newContentY !== flickable.contentY)
             animateFlickableContentY(newContentY)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/19364a7beb85e124eba4f6b9b69846bf2b129e6f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/19364a7beb85e124eba4f6b9b69846bf2b129e6f
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