[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: set content width only when orientation is vertical in ListViewExt
François Cartegnie (@fcartegnie)
gitlab at videolan.org
Sat Aug 31 06:59:36 UTC 2024
François Cartegnie pushed to branch master at VideoLAN / VLC
Commits:
e895763b by Fatih Uzunoglu at 2024-08-31T06:30:37+00:00
qml: set content width only when orientation is vertical in ListViewExt
ListView estimates the content width when it has horizontal
orientation by default, it is not a good idea to override
this estimation.
- - - - -
0dd936d7 by Fatih Uzunoglu at 2024-08-31T06:30:37+00:00
qml: consider left and right margins for content width in ListViewExt
These margins come from the type `Flickable`, and should be considered
here.
- - - - -
8bf7ebe4 by Fatih Uzunoglu at 2024-08-31T06:30:37+00:00
qml: set content height when orientation is horizontal in ListViewExt
We were already setting the content width, primarily for vertical
list view. However, there is no restriction as such that ListViewExt
can not be used in horizontal orientation.
By default, list view does not estimate content height when the
orientation is horizontal. However, in most cases if not all, the
delegate uses the content size to set its size. For example, in a
vertical list view, it is sensible that the delegate uses content
width to determine its width.
If the delegate does not set its width when orientation is vertical,
or height when orientation is horizontal based on content width and
height, respectively, then it is the view's responsibility to override
the content size.
- - - - -
1 changed file:
- modules/gui/qt/widgets/qml/ListViewExt.qml
Changes:
=====================================
modules/gui/qt/widgets/qml/ListViewExt.qml
=====================================
@@ -98,10 +98,11 @@ ListView {
section.criteria: ViewSection.FullString
section.delegate: sectionHeading
- // Content width is set to the width by default
+ // Content size is set to the size by default
// If the delegate does not obey it, calculate
- // the content width appropriately.
- contentWidth: width
+ // the content size appropriately.
+ contentWidth: (orientation === ListView.Vertical) ? width - (leftMargin + rightMargin) : -1
+ contentHeight: (orientation === ListView.Horizontal) ? height - (topMargin + bottomMargin) : -1
footer: !!root.acceptDropFunc ? footerDragAccessoryComponent : null
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2b11ea68f2f59da8ec8ed1ce81f8ade6dda5fe18...8bf7ebe4d7d3de209c2c0993a02245f4c0625a6f
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2b11ea68f2f59da8ec8ed1ce81f8ade6dda5fe18...8bf7ebe4d7d3de209c2c0993a02245f4c0625a6f
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