[vlc-commits] [Git][videolan/vlc][master] qml: make scroll bar invisible if it does not show anything

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Apr 7 10:08:59 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
c9e0641f by Fatih Uzunoglu at 2025-04-07T09:49:35+00:00
qml: make scroll bar invisible if it does not show anything

This makes it possible to not consume the events when there
is nothing shown. We can do this because in this scroll bar
style when `size` is smaller than 1.0, the handle is always
visible. So this change is mostly relevant when `size` is
1.0, which means viewport size covers the content size.

This is useful for situations such as, playlist height is
equal or greater than the combined height of the items added
to it. With this patch, clicking on the items where the scroll
bar would be shown makes it possible for items to react to
the events (such as, selecting or showing the context menu).

I did not use `background.visible` or `contentItem.visible`
because they already depend on the control's visibility (as
if parent is invisible the children would be invisible).

- - - - -


1 changed file:

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


Changes:

=====================================
modules/gui/qt/widgets/qml/ScrollBarExt.qml
=====================================
@@ -30,10 +30,10 @@ T.ScrollBar {
                              implicitContentHeight + topPadding + bottomPadding)
 
     padding: VLCStyle.dp(2, VLCStyle.scale)
-    visible: policy !== T.ScrollBar.AlwaysOff
+    visible: policy !== T.ScrollBar.AlwaysOff && ((background && background.opacity > 0.0) || (contentItem && contentItem.opacity > 0.0))
     minimumSize: horizontal ? (height / width) : (width / height)
 
-    // We don't want to show anything is scrolling is not possible (content size less than
+    // We don't want to show anything if scrolling is not possible (content size less than
     // or equal to flickable size), unless `ScrollBar.AlwaysOn` is used (not by default):
     readonly property bool _shown: (policy === T.ScrollBar.AlwaysOn) || (control.size < 1.0)
 



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

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