Repository navigation
fix: handle zero-height content in arrow list view - #759
18202781743 wants to merge 1 commit into
Conversation
1. Add hasDelegate property to track if any delegate has been realized 2. Update sizedHeight logic to treat zero content height as valid when delegates exist 3. Remove temporary viewport fallback in ComboBox popup implicitHeight 4. Set hasDelegate flag during refreshContentItemWidth iteration The previous logic assumed contentHeight == 0 meant delegates weren't realized yet, causing a fallback viewport height. When delegates exist but measure zero height, this produced incorrect popup sizing. Tracking delegate realization explicitly distinguishes "not yet realized" from "realized with zero height". Influence: 1. Test ComboBox popup with empty model - should show appropriate minimum height 2. Test ComboBox popup with single item - verify no double-height gap 3. Test ComboBox popup with items having zero-height delegates 4. Verify ArrowListView sizing with various item counts 5. Test popup height recalculation when model changes dynamically 6. Verify popup renders correctly when delegates become visible fix: 修复箭头列表视图中零高度内容的处理 1. 添加 hasDelegate 属性以跟踪是否已实现任何委托 2. 更新 sizedHeight 逻辑,当存在委托时将零内容高度视为有效 3. 移除 ComboBox 弹出层 implicitHeight 中的临时视口回退逻辑 4. 在 refreshContentItemWidth 迭代期间设置 hasDelegate 标志 之前的逻辑假设 contentHeight == 0 意味着委托尚未实现,导致回退到视口高 度。当委托存在但测量高度为零时,这会导致弹出层尺寸错误。显式跟踪委托实现 状态可区分“尚未实现”和“已实现但高度为零”。 Influence: 1. 测试空模型的 ComboBox 弹出层 - 应显示适当的最小高度 2. 测试单条目的 ComboBox 弹出层 - 验证无双倍高度间隙 3. 测试委托高度为零的 ComboBox 弹出层 4. 验证不同条目数量下 ArrowListView 的尺寸 5. 测试模型动态变化时弹出层高度的重新计算 6. 验证委托变为可见时弹出层的正确渲染 Log: Fixed ComboBox popup sizing when content has zero measured height PMS: BUG-380893
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideImplementationTrack whether a delegate has been realized and use that state to distinguish zero-height content from content that has not yet been measured.
UIRemove the ComboBox popup's temporary viewport-height fallback so its implicit height follows the ArrowListView's measured height.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="qt6/src/qml/ArrowListView.qml" line_range="27" />
<code_context>
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
</code_context>
<issue_to_address>
**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.
</issue_to_address>
### Comment 2
<location path="qt6/src/qml/ComboBox.qml" line_range="175" />
<code_context>
- // 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 {
</code_context>
<issue_to_address>
**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.
</issue_to_address>| return 0 | ||
| if (itemsView.contentHeight > 0) | ||
| // Once a delegate exists, zero is a valid measured content height. | ||
| if (itemsView.contentHeight > 0 || itemsView.hasDelegate) |
There was a problem hiding this comment.
🟡 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.| // 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 |
There was a problem hiding this comment.
🟡 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.
delegates exist
The previous logic assumed contentHeight == 0 meant delegates weren't
realized yet, causing a fallback viewport height. When delegates exist
but measure zero height, this produced incorrect popup sizing. Tracking
delegate realization explicitly distinguishes "not yet realized" from
"realized with zero height".
Influence:
minimum height
fix: 修复箭头列表视图中零高度内容的处理
之前的逻辑假设 contentHeight == 0 意味着委托尚未实现,导致回退到视口高
度。当委托存在但测量高度为零时,这会导致弹出层尺寸错误。显式跟踪委托实现
状态可区分“尚未实现”和“已实现但高度为零”。
Influence:
Log: Fixed ComboBox popup sizing when content has zero measured height
PMS: BUG-380893
Summary by Sourcery
Correct ArrowListView and ComboBox popup sizing for realized content with zero measured height.
Bug Fixes:
Enhancements: