[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: implement delegate z-tiling in `ListViewExt`
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Wed Oct 14 14:14:36 UTC 2026
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
0f799cbd by Fatih Uzunoglu at 2026-10-14T15:42:35+02:00
qml: implement delegate z-tiling in `ListViewExt`
Akin to 2395eb29, but since this is list view,
the algorithm is more trivial.
- - - - -
ce4af2f7 by Fatih Uzunoglu at 2026-10-14T15:42:35+02:00
qml: increase default compensation factor to 3.0 in `RoundedRectangleShadow`
2.0 was chosen to be a balanced value, where clipping is not as noticeable
as 1.0 or 1.5, but at the same time making it less likely for shadows to
overlap.
Overlapping shadows is mostly a concern within item view delegates, since
batch rendering is especially important there. However, 2.0 is not really
tweaked for our view delegates:
- In grid view, overlapping is less of a problem because of z-tiling,
implemented in 2395eb29.
- In list view, the spacing available is not big enough for 2.0 to prevent
overlapping. The shadows are overlapped anyway (at least in the playlist),
so we might as well use 3.0.
Z-tiling in list view when there are no transitions is implemented in a
subsequent patch, where overlapping would become less of a problem there
too.
- - - - -
5 changed files:
- modules/gui/qt/maininterface/qml/MainInterface.qml
- modules/gui/qt/playlist/qml/PlaylistPane.qml
- modules/gui/qt/widgets/qml/ListViewExt.qml
- modules/gui/qt/widgets/qml/RoundedRectangleShadow.qml
- modules/gui/qt/widgets/qml/TableViewExt.qml
Changes:
=====================================
modules/gui/qt/maininterface/qml/MainInterface.qml
=====================================
@@ -379,9 +379,6 @@ Item {
// factor which can lead to visible clipping, or increase the window extended margin:
blurRadius: (MainCtx.windowExtendedMargin / effect.compensationFactor)
- // 2.0 (default) compensation factor makes clipping obvious, especially with white background
- implicitCompensationFactor: 3.0
-
compensationFactor: MainCtx.intfMainWindow.active ? (implicitCompensationFactor)
: (implicitCompensationFactor * 2)
=====================================
modules/gui/qt/playlist/qml/PlaylistPane.qml
=====================================
@@ -518,6 +518,10 @@ T.Pane {
else if (listView.fadingEdge.excludeItem === delegate)
listView.fadingEdge.excludeItem = null
}
+
+ Component.onCompleted: {
+ listView.delegateInstantiated(delegate)
+ }
}
Keys.onDeletePressed: {
=====================================
modules/gui/qt/widgets/qml/ListViewExt.qml
=====================================
@@ -33,6 +33,15 @@ ListView {
// Optional
property ListSelectionModel selectionModel
+ // Useful for batch rendering when the delegate draws things outside the cell, which
+ // is the case with shadow effect. Note that this change affects how the view looks,
+ // if the overlapping parts of delegate are not using commutative blending (which
+ // is the case by default with source-over blending in scene graph), but it is not
+ // really obvious with the shadows. Note that item delegate must emit view signal
+ // `onDelegateInstantiated` with a parameter of itself when instantiated for this
+ // to work.
+ property bool delegateZTiling: true
+
// Optional property for drop indicator placement and auto scroll feature:
property var itemContainsDrag: undefined
@@ -62,6 +71,43 @@ ListView {
signal showContextMenu(point globalPos)
+ signal delegateInstantiated(Item instance)
+
+ onDelegateInstantiated: (instance /*: Item*/) => {
+ console.assert(instance)
+ delegateZTilingBindingComponent.incubateObject(instance,
+ {'targetItem': instance},
+ 1 /* QQmlIncubator::AsynchronousIfNested */)
+ }
+
+ Component {
+ id: delegateZTilingBindingComponent
+
+ Binding {
+ required property Item targetItem
+
+ when: root.delegateZTiling
+
+ target: targetItem
+
+ // We can do this, as the view we can manage the `z` of delegate.
+ property: "z"
+
+ value: {
+ if (!targetItem)
+ return
+
+ const delegateIndex = targetItem.index
+ console.assert(Number.isInteger(delegateIndex))
+
+ // Divide by 10 to create a z group (1.0 to 1.3) for this purpose, so
+ // that non-delegate items can remain stacked properly with regard
+ // to their z. Note that `z` does not need to be integer for items:
+ return (root.move?.running || root.moveDisplaced?.running) ? 1 : ((delegateIndex % 4) / 10.0 + 1)
+ }
+ }
+ }
+
// Private
property int _currentFocusReason: Qt.OtherFocusReason
=====================================
modules/gui/qt/widgets/qml/RoundedRectangleShadow.qml
=====================================
@@ -60,7 +60,7 @@ ShaderEffect {
// Increase the compensation factor if clipping occurs, but make it as small as possible
// to prevent overlapping shadows (breaks batching) and to decrease the shader coverage:
property real compensationFactor: implicitCompensationFactor
- property real implicitCompensationFactor: 2.0
+ property real implicitCompensationFactor: 3.0
// Do not paint in the non-compensated inner area - only makes sense if there is compensation:
property bool hollow: false
=====================================
modules/gui/qt/widgets/qml/TableViewExt.qml
=====================================
@@ -406,5 +406,9 @@ ListViewExt {
}
onContainsDragChanged: root.updateItemContainsDrag(this, containsDrag)
+
+ Component.onCompleted: {
+ root.delegateInstantiated(tableDelegate)
+ }
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a76e29b02d2c6e2f715669f19a94abd70ab2daf1...ce4af2f7eff10fce17911dcb71f32f05fb90c98b
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a76e29b02d2c6e2f715669f19a94abd70ab2daf1...ce4af2f7eff10fce17911dcb71f32f05fb90c98b
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list