[vlc-commits] [Git][videolan/vlc][master] qml: do not use `positionViewAtIndex()` on key navigation unless necessary in `ListViewExt`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Oct 3 04:52:38 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
c940ed29 by Fatih Uzunoglu at 2025-10-03T04:32:10+00:00
qml: do not use `positionViewAtIndex()` on key navigation unless necessary in `ListViewExt`
Normally the view itself does positioning, provided that `highlightFollowsCurrentItem` is
enabled (default). When `positionViewAtIndex()` is used, that is not the case, but as the
note tells, the item may end up behind the header or footer without it. This is not a Qt
bug, because the option is named as overlay, which means the items are supposed to go
behind.
Ideally the `positionViewAtIndex()` should not be used at all, because the correct way of
having header or footer that are neither meant to be overlay or inline seems to be having
them outside the view, such as how it is done in playqueue. Unfortunately Qt does not seem
to offer this option built-in in the views.
- - - - -
1 changed file:
- modules/gui/qt/widgets/qml/ListViewExt.qml
Changes:
=====================================
modules/gui/qt/widgets/qml/ListViewExt.qml
=====================================
@@ -552,7 +552,23 @@ ListView {
root.updateSelection(event.modifiers, oldIndex, newIndex);
// NOTE: If we skip this call the item might end up under the header.
- positionViewAtIndex(currentIndex, ItemView.Contain);
+ if (root.highlightFollowsCurrentItem) {
+ // FIXME: Items can go beneath `OverlayHeader` or `OverlayFooter`.
+ // We should move the header and footer outside of the view,
+ // if we do not want that behavior instead of having this
+ // workaround, as Qt does not seem to offer that configuration
+ // as a built-in mode in its views.
+
+ if (root.headerItem && (root.headerPositioning !== ListView.InlineHeader)) {
+ if (root.currentItem.y < (root.headerItem.y + root.headerItem.height))
+ positionViewAtIndex(currentIndex, ItemView.Contain);
+ }
+
+ if (root.footerItem && (root.footerPositioning !== ListView.InlineFooter)) {
+ if (root.currentItem.y > root.footerItem.y)
+ positionViewAtIndex(currentIndex, ItemView.Contain);
+ }
+ }
// NOTE: We make sure we have the proper visual focus on components.
if (oldIndex < currentIndex)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c940ed291c3a1847d81ed71aa41e2fdb1712137d
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c940ed291c3a1847d81ed71aa41e2fdb1712137d
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