fix(ui): calculate scroll offset only for visible widgets#636
Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom Apr 8, 2026
Merged
fix(ui): calculate scroll offset only for visible widgets#636deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts scroll offset calculation in PageDetail so that only visible widgets contribute to the vertical scroll value, and updates the SPDX copyright years. Sequence diagram for updated scroll offset calculation in PageDetailsequenceDiagram
actor User
participant PageDetail
participant TextBrowserList
participant DetailButtonList
participant DetailSeparatorList
participant ScrollArea
participant VerticalScrollBar
User->>PageDetail: showInfoOfNum(index)
activate PageDetail
PageDetail->>PageDetail: value = 0
loop for i = 0 to index - 1
PageDetail->>TextBrowserList: m_ListTextBrowser[i].isVisible()
alt text browser visible
PageDetail->>PageDetail: value += m_ListTextBrowser[i].height()
end
PageDetail->>DetailButtonList: m_ListDetailButton[i].isVisible()
alt detail button visible
PageDetail->>PageDetail: value += m_ListDetailButton[i].height()
end
PageDetail->>DetailSeparatorList: m_ListDetailSeperator[i].isVisible()
alt separator visible
PageDetail->>PageDetail: value += m_ListDetailSeperator[i].height()
end
PageDetail->>PageDetail: value += SPACE_HEIGHT
end
PageDetail->>ScrollArea: mp_ScrollArea
ScrollArea->>VerticalScrollBar: verticalScrollBar()
VerticalScrollBar-->>ScrollArea: QScrollBar
PageDetail->>VerticalScrollBar: setValue(value)
deactivate PageDetail
Class diagram for PageDetail scroll offset logic updateclassDiagram
class PageDetail {
+showInfoOfNum(index int) void
-m_ListTextBrowser QList~QTextBrowser*~
-m_ListDetailButton QList~QPushButton*~
-m_ListDetailSeperator QList~QWidget*~
-mp_ScrollArea QScrollArea*
}
class QTextBrowser {
+isVisible() bool
+height() int
}
class QPushButton {
+isVisible() bool
+height() int
}
class QWidget {
+isVisible() bool
+height() int
}
class QScrollArea {
+verticalScrollBar() QScrollBar*
}
class QScrollBar {
+setValue(value int) void
}
PageDetail --> QTextBrowser : uses m_ListTextBrowser
PageDetail --> QPushButton : uses m_ListDetailButton
PageDetail --> QWidget : uses m_ListDetailSeperator
PageDetail --> QScrollArea : uses mp_ScrollArea
QScrollArea --> QScrollBar : returns
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="deepin-devicemanager/src/Page/PageDetail.cpp" line_range="224-226" />
<code_context>
- value += m_ListTextBrowser[i]->height();
- value += m_ListDetailButton[i]->height();
- value += m_ListDetailSeperator[i]->height();
+ if (m_ListTextBrowser[i]->isVisible()) value += m_ListTextBrowser[i]->height();
+ if (m_ListDetailButton[i]->isVisible()) value += m_ListDetailButton[i]->height();
+ if (m_ListDetailSeperator[i]->isVisible()) value += m_ListDetailSeperator[i]->height();
value += SPACE_HEIGHT;
}
</code_context>
<issue_to_address>
**issue (bug_risk):** Consider whether SPACE_HEIGHT should be added only when at least one of the widgets is visible.
As a result, fully hidden items still add spacing, which can produce incorrect scroll offsets when many items are invisible. If hidden items should be completely skipped, gate the `SPACE_HEIGHT` addition on at least one of the three widgets being visible for that index.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
calculate scroll offset only for visible widgets log: calculate scroll offset only for visible widgets pms: https://pms.uniontech.com/bug-view-345913.html
max-lvs
approved these changes
Apr 7, 2026
GongHeng2017
approved these changes
Apr 7, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, GongHeng2017, max-lvs 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 |
Contributor
Author
|
/forcemerge |
Contributor
|
This pr force merged! (status: unstable) |
fb2fa52
into
linuxdeepin:develop/eagle
20 of 22 checks passed
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.
calculate scroll offset only for visible widgets
log: calculate scroll offset only for visible widgets
pms: https://pms.uniontech.com/bug-view-345913.html
Summary by Sourcery
Adjust the device detail page scrolling to account only for visible widgets when calculating the vertical offset.
Bug Fixes:
Enhancements: