fix: Bluetooth item listView can display full items#362
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefined how the Bluetooth list view’s scroll area and content widget heights are calculated by introducing a computed scrollAreaHeight and ensuring the content widget’s minimum height adapts to both the adapter content and available scroll space. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- Clamp scrollAreaHeight to a non-negative value before calling setFixedHeight to avoid passing a negative height when the container is too small.
- Consider also setting a maximumHeight on m_contentWidget so its content won’t grow unbounded beyond the scroll area.
- Extract the height calculation logic into a helper function or inline block to centralize the math and improve readability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Clamp scrollAreaHeight to a non-negative value before calling setFixedHeight to avoid passing a negative height when the container is too small.
- Consider also setting a maximumHeight on m_contentWidget so its content won’t grow unbounded beyond the scroll area.
- Extract the height calculation logic into a helper function or inline block to centralize the math and improve readability.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, yixinshark 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 |
ensure content widget height adapts to scroll area size Log: as title Pms: BUG-300891
a27159c to
d4745e8
Compare
deepin pr auto review我对这段代码进行了审查,发现了一些可以改进的地方:
改进建议代码示例: void BluetoothApplet::updateSize()
{
// ... 其他代码 ...
// 设置滚动区高度
const int scrollAreaHeight = height - settingHeight - m_disableWidget->height() - m_airplaneModeWidget->height();
if (m_scrollArea) {
m_scrollArea->setFixedHeight(scrollAreaHeight);
}
// 确保内容控件高度至少等于适配器高度,并且不会超过滚动区域的高度太多
if (m_contentWidget) {
m_contentWidget->setMinimumHeight(qMax(adapterHeight, scrollAreaHeight));
}
// top and bottom margin
height += hMargins;
// ... 其他代码 ...
}这些改进可以提高代码的健壮性和可维护性,同时保持原有功能不变。 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
ensure content widget height adapts to scroll area size
Log: as title
Pms: BUG-300891
Summary by Sourcery
Fix height calculation for the Bluetooth item list view to ensure full items are displayed without clipping.
Bug Fixes: