fix(arrowlistview): fix ArrowListView height oscillation and item clipping - #675
Merged
Merged
Conversation
…pping 1. Show arrow buttons constantly when interactive, grey them out via internal enabled instead of hiding them, so layout height stays fixed 2. Size the viewport by real item height (contentHeight / count) rather than the static style itemHeight, so the last visible item is not clipped 3. Simplify the interactive condition to model.count vs maxVisibleItems 4. Use implicitHeight for the button layout preferred height Log: Fix ArrowListView height fluctuating while scrolling and the last item being clipped when actual item height differs from itemHeight Influence: Lists in menus and ComboBoxes no longer resize during scroll fix(arrowlistview): 修复 ArrowListView 滚动时高度振荡与末项被裁剪 1. 箭头按钮改为占用布局后通过内部 enabled 置灰,避免隐藏按钮改变高度 2. 视口改用真实项高(contentHeight/count)计算,替换静态 itemHeight, 使最后一个可见项不被裁剪 3. interactive 改用 count 与 maxVisibleItems 比较 4. 按钮布局期望高度改用 implicitHeight Log: 修复列表滚动时高度抖动以及实际项高与 itemHeight 不一致时末项被裁剪 PMS: BUG-375249 Influence: 菜单/下拉列表滚动时不再跳动,末项完整显示 Change-Id: I09a7ef250f82eebf20784336301d24789cad99e6
mhduiy
force-pushed
the
fix-arrowlistview-height
branch
from
August 31, 2026 09:20
82305a3 to
c9054b7
Compare
18202781743
reviewed
Aug 31, 2026
Contributor
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 对于 Menu/ComboBox 弹出场景,delegate 高度受控,简化是合理的。如需兼容更通用的场景,可考虑保留 contentHeight 溢出检查作为兜底条件 2. 代码质量 ✅评价: 良好 ✅ 通过 潜在问题:
建议: 在 implicitHeight 计算处添加注释说明 contentHeight / count 是实际 delegate 高度;考虑将 stepSize 也改为基于实际 item 高度(contentHeight / count)以保持一致性 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 性能良好,implicitHeight 中的除法运算是 O(1) 复杂度,interactive 条件简化后减少了 Window.window 属性查找开销 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: QML UI 组件,无安全敏感操作,无需额外安全加固 💡 改进建议代码示例// 建议添加注释并统一 stepSize
ListView {
id: itemsView
clip: true
Layout.fillWidth: true
Layout.fillHeight: true
// 使用实际 delegate 高度(contentHeight / count)而非静态 itemHeight
implicitHeight: itemsView.count > 0 ? Math.min(contentHeight, maxVisibleItems * contentHeight / itemsView.count) : 0
// ...
interactive: model.count > maxVisibleItems
}
// ArrowListViewButton 中 stepSize 可考虑使用实际 item 高度
P.ArrowListViewButton {
// ...
stepSize: itemsView.count > 0 ? (itemsView.contentHeight / itemsView.count) : control.itemHeight
// ...
}本报告由 AI 代码审查工具自动生成 |
18202781743
approved these changes
Aug 31, 2026
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix two layout problems in
ArrowListView(used by Menu and ComboBox popups):atYEnd/atYBeginning, but the buttons are children of the same ColumnLayout thatsizes the ListView, so toggling them changed the list height → scroll range → boundary
state → infinite feedback loop. Buttons now stay in the layout (greyed out via their
internal
enabledat boundaries) so height stays constant.itemHeight, but the realdelegate height (
contentHeight / count) can differ, clipping the last visible item.Viewport now derives from actual item height.
Also: use
implicitHeightfor the button layout preferred height, and simplify theinteractivecondition.PMS: BUG-375249