Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions qt6/src/qml/ArrowListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ FocusScope {
property int itemHeight: DS.Style.arrowListView.itemHeight
property alias view: itemsView

// Full height of the list, to size a popup before it is mapped.
readonly property real sizedHeight: {
if (itemsView.count === 0)
return 0
const item = itemsView.itemAtIndex(0)
const measured = itemsView.contentHeight > 0 && item ? (item.height || item.implicitHeight) : 0
const arrowStrips = itemsView.count > maxVisibleItems
? 2 * (DS.Style.arrowListView.stepButtonIconSize.height + contentLayout.spacing) : 0
return Math.min(itemsView.count, maxVisibleItems) * (measured > 0 ? measured : itemHeight) + arrowStrips
}

implicitWidth: Math.max(DS.Style.arrowListView.width, contentLayout.implicitWidth)
implicitHeight: contentLayout.implicitHeight

Expand All @@ -25,7 +36,7 @@ FocusScope {
visible: itemsView.interactive
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.preferredHeight: implicitHeight
Layout.preferredHeight: DS.Style.arrowListView.stepButtonIconSize.height
view: itemsView
stepSize: control.itemHeight
direction: P.ArrowListViewButton.UpButton
Expand All @@ -36,6 +47,7 @@ FocusScope {
clip: true
Layout.fillWidth: true
Layout.fillHeight: true
onHeightChanged: if (height > 0 && contentHeight === 0) forceLayout()
implicitHeight: itemsView.count > 0 ? Math.min(contentHeight, maxVisibleItems * contentHeight / itemsView.count) : 0
implicitWidth:{
var maxWidth = DS.Style.arrowListView.width
Expand Down Expand Up @@ -81,7 +93,7 @@ FocusScope {
visible: itemsView.interactive
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.preferredHeight: implicitHeight
Layout.preferredHeight: DS.Style.arrowListView.stepButtonIconSize.height
view: itemsView
stepSize: control.itemHeight
direction: P.ArrowListViewButton.DownButton
Expand Down
3 changes: 3 additions & 0 deletions qt6/src/qml/ComboBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ T.ComboBox {
rightMargin: DS.Style.popup.margin
palette: control.palette
implicitWidth: control.flat ? Math.max(contentItem.implicitWidth, control.width) : control.width
// 60 is a temporary viewport so the list can realize one row and be measured.
implicitHeight: (contentItem.sizedHeight > 0 ? contentItem.sizedHeight : 2 * DS.Style.arrowListView.itemHeight)
+ topPadding + bottomPadding
onClosed: control.isInteractingWithContent = false
Connections {
target: control
Expand Down
Loading