diff --git a/qt6/src/qml/ArrowListView.qml b/qt6/src/qml/ArrowListView.qml index eb2e848a..7aecf42a 100644 --- a/qt6/src/qml/ArrowListView.qml +++ b/qt6/src/qml/ArrowListView.qml @@ -23,7 +23,8 @@ FocusScope { readonly property real sizedHeight: { if (itemsView.count === 0) return 0 - if (itemsView.contentHeight > 0) + // Once a delegate exists, zero is a valid measured content height. + if (itemsView.contentHeight > 0 || itemsView.hasDelegate) return implicitHeight const arrowStrips = itemsView.count > maxVisibleItems ? 2 * (DS.Style.arrowListView.stepButtonIconSize.height + contentLayout.spacing) : 0 @@ -57,6 +58,7 @@ FocusScope { ListView { id: itemsView property real itemMaxWidth: 0 + property bool hasDelegate: false clip: true Layout.fillWidth: true Layout.fillHeight: true @@ -98,9 +100,13 @@ FocusScope { function refreshContentItemWidth() { var maxWidth = itemMaxWidth + var foundDelegate = false for (var i = 0; i < itemsView.count; ++i) { var item = itemsView.itemAtIndex(i) - if (!item || !item.visible) + if (!item) + continue + foundDelegate = true + if (!item.visible) continue item.width = itemsView.width if (control._measuredRowHeight <= 0 && item.height > 0) @@ -108,6 +114,7 @@ FocusScope { if (item.implicitWidth > maxWidth) maxWidth = item.implicitWidth } + hasDelegate = foundDelegate itemMaxWidth = maxWidth } } diff --git a/qt6/src/qml/ComboBox.qml b/qt6/src/qml/ComboBox.qml index 7d61c936..48302dcd 100644 --- a/qt6/src/qml/ComboBox.qml +++ b/qt6/src/qml/ComboBox.qml @@ -172,9 +172,7 @@ T.ComboBox { rightMargin: DS.Style.popup.margin palette: control.palette implicitWidth: control.flat ? Math.max(contentItem.implicitWidth + leftPadding + rightPadding, 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 + implicitHeight: contentItem.sizedHeight + topPadding + bottomPadding onClosed: control.isInteractingWithContent = false Connections { target: control