[vlc-commits] [Git][videolan/vlc][master] qml: take display margins into consideration in FadingEdgeListView

François Cartegnie (@fcartegnie) gitlab at videolan.org
Sat Dec 17 18:07:11 UTC 2022



François Cartegnie pushed to branch master at VideoLAN / VLC


Commits:
10ab9544 by Fatih Uzunoglu at 2022-12-17T17:52:04+00:00
qml: take display margins into consideration in FadingEdgeListView

- - - - -


1 changed file:

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


Changes:

=====================================
modules/gui/qt/widgets/qml/FadingEdgeListView.qml
=====================================
@@ -77,12 +77,12 @@ ListView {
             if (headerItem && headerItem.visible && headerPositioning === ListView.OverlayHeader)
                 margin += headerItem.height
 
-            return itemAt(contentX + (delegateItem.x + delegateItem.width / 2), contentY + margin)
+            return itemAt(contentX + (delegateItem.x + delegateItem.width / 2), contentY + margin - displayMarginBeginning + spacing)
         } else {
             if (headerItem && headerItem.visible && headerPositioning === ListView.OverlayHeader)
                 margin += headerItem.width
 
-            return itemAt(contentX + margin, contentY + (delegateItem.y + delegateItem.height / 2))
+            return itemAt(contentX + margin - displayMarginBeginning + spacing, contentY + (delegateItem.y + delegateItem.height / 2))
         }
     }
 
@@ -95,12 +95,12 @@ ListView {
             if (footerItem && footerItem.visible && footerPositioning === ListView.OverlayFooter)
                 margin += footerItem.height
 
-            return itemAt(contentX + (delegateItem.x + delegateItem.width / 2), contentY + height - margin - 1)
+            return itemAt(contentX + (delegateItem.x + delegateItem.width / 2), contentY + height - margin + displayMarginEnd - spacing - 1)
         } else {
             if (footerItem && footerItem.visible && footerPositioning === ListView.OverlayFooter)
                 margin += footerItem.width
 
-            return itemAt(contentX + width - margin - 1, contentY + (delegateItem.y + delegateItem.height / 2))
+            return itemAt(contentX + width - margin + displayMarginEnd - spacing - 1, contentY + (delegateItem.y + delegateItem.height / 2))
         }
     }
 
@@ -162,15 +162,18 @@ ListView {
         anchors.top: parent.top
         anchors.left: parent.left
 
-        implicitWidth: Math.ceil(parent.width)
-        implicitHeight: Math.ceil(parent.height)
+        anchors.leftMargin: (orientation === ListView.Horizontal ? -displayMarginBeginning : 0)
+        anchors.topMargin: (orientation === ListView.Vertical ? -displayMarginBeginning : 0)
+
+        implicitWidth: Math.ceil(parent.width + (orientation === ListView.Horizontal ? (displayMarginBeginning + displayMarginEnd) : 0))
+        implicitHeight: Math.ceil(parent.height + (orientation === ListView.Vertical ? (displayMarginBeginning + displayMarginEnd) : 0))
 
         z: root.contentItem.z
 
         sourceItem: root.contentItem
 
-        sourceRect: Qt.rect(root.contentX,
-                            root.contentY,
+        sourceRect: Qt.rect(root.contentX - (orientation === ListView.Horizontal ? displayMarginBeginning : 0),
+                            root.contentY - (orientation === ListView.Vertical ? displayMarginBeginning : 0),
                             width,
                             height)
 
@@ -182,8 +185,10 @@ ListView {
         // If background rectangle is fully opaque,
         // the texture does not need an alpha
         // channel: (optimization)
-        format: (contentItemCoverRect.visible && Helpers.compareFloat(1.0, contentItemCoverRect.color.a)) ? ShaderEffectSource.RGB
-                                                                                                          : ShaderEffectSource.RGBA
+        format: (contentItemCoverRect.visible
+                 && Helpers.compareFloat(1.0, contentItemCoverRect.color.a)
+                 && (displayMarginBeginning <= 0 && displayMarginEnd <= 0)) ? ShaderEffectSource.RGB
+                                                                            : ShaderEffectSource.RGBA
 
         layer.enabled: true
         layer.effect: ShaderEffect {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/10ab9544ee26aace7b8652d5d7fbb5d4bbff2c1e

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