Skip to content
Closed
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
11 changes: 9 additions & 2 deletions qt6/src/qml/ArrowListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Nonempty lists stay collapsed

When a delegate is realized before it has a positive measured height, itemsView.hasDelegate makes ArrowListView.sizedHeight return implicitHeight while itemsView.contentHeight is still zero, leaving the ListView without a positive viewport to measure height-dependent or later delegates and keeping the popup collapsed.

Use the provisional viewport estimate until itemsView.contentHeight is positive instead of treating itemsView.hasDelegate alone as a measured height.

Prompt for AI agents
In `qt6/src/qml/ArrowListView.qml` at line 27:

**Nonempty lists stay collapsed**

When a delegate is realized before it has a positive measured height, `itemsView.hasDelegate` makes `ArrowListView.sizedHeight` return `implicitHeight` while `itemsView.contentHeight` is still zero, leaving the ListView without a positive viewport to measure height-dependent or later delegates and keeping the popup collapsed.

Use the provisional viewport estimate until `itemsView.contentHeight` is positive instead of treating `itemsView.hasDelegate` alone as a measured height.

return implicitHeight
const arrowStrips = itemsView.count > maxVisibleItems
? 2 * (DS.Style.arrowListView.stepButtonIconSize.height + contentLayout.spacing) : 0
Expand Down Expand Up @@ -57,6 +58,7 @@ FocusScope {
ListView {
id: itemsView
property real itemMaxWidth: 0
property bool hasDelegate: false
clip: true
Layout.fillWidth: true
Layout.fillHeight: true
Expand Down Expand Up @@ -98,16 +100,21 @@ 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)
control._measuredRowHeight = item.height
if (item.implicitWidth > maxWidth)
maxWidth = item.implicitWidth
}
hasDelegate = foundDelegate
itemMaxWidth = maxWidth
}
}
Expand Down
4 changes: 1 addition & 3 deletions qt6/src/qml/ComboBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Empty popups have no height

When the ComboBox model is empty and its popup is opened, contentItem.sizedHeight is zero, so the ComboBox binding sets implicitHeight to the popup's default zero vertical padding and overrides the background's implicit minimum; the popup appears collapsed.

Restore a fallback minimum-height estimate when contentItem.sizedHeight is zero.

Prompt for AI agents
In `qt6/src/qml/ComboBox.qml` at line 175:

**Empty popups have no height**

When the ComboBox model is empty and its popup is opened, `contentItem.sizedHeight` is zero, so the `ComboBox` binding sets `implicitHeight` to the popup's default zero vertical padding and overrides the background's implicit minimum; the popup appears collapsed.

Restore a fallback minimum-height estimate when `contentItem.sizedHeight` is zero.

onClosed: control.isInteractingWithContent = false
Connections {
target: control
Expand Down
Loading