Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust scroll behavior in list view mode #2452

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

Lighto-Ku
Copy link
Contributor

Calculate correct content height for list/tree mode to ensure proper scrolling

Log: fix list view issue
Bug: https://pms.uniontech.com/bug-view-291285.html

Calculate correct content height for list/tree mode to ensure proper scrolling

Log: fix list view issue
Bug: https://pms.uniontech.com/bug-view-291285.html
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. fileview.cpp文件中新增的totalHeight变量在else分支中初始化,但在if分支中并没有使用到。如果totalHeightif分支中不需要,建议删除该变量以避免混淆。

  2. updateGeometries函数中,totalHeight变量在ifelse分支中分别计算,但最终都赋值给了d->lastContentHeight。如果这两个分支的计算结果总是相同的,可以考虑合并这两个分支,以简化代码逻辑。

  3. else分支中,listHeight的计算使用了kListModeBottomMargin,但在if分支中并没有使用到这个常量。如果kListModeBottomMarginif分支中不需要,建议删除该常量以避免不必要的常量定义。

  4. resizeContents函数中,contentsSize().height()被调用了两次,可以考虑将其结果存储在一个变量中,以减少函数调用的次数,提高代码性能。

  5. resizeContents函数中,d->headerView->length()被用作resizeContents的第一个参数,但没有检查d->headerView是否为nullptr。如果d->headerView可能为nullptr,建议添加相应的空指针检查,以避免潜在的空指针解引用问题。

  6. resizeContents函数中,DListView::updateGeometries()被调用两次,一次在if分支中,一次在else分支中。如果这两个分支的逻辑是相同的,可以考虑将DListView::updateGeometries()的调用移到if分支之外,以简化代码逻辑。

  7. fileview.cpp文件中,#ifdef DTKWIDGET_CLASS_DSizeMode#endif之间的代码块可能需要根据实际情况进行适当的修改,以确保代码的正确性。

  8. fileview.cpp文件中,itemSizeHint().height()被用作计算listHeight的一部分,但没有检查itemSizeHint()是否返回有效的值。如果itemSizeHint()可能返回无效的值,建议添加相应的检查,以避免潜在的运行时错误。

以上是针对代码审查意见的详细说明,希望能够对您有所帮助。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Lighto-Ku, max-lvs

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Lighto-Ku
Copy link
Contributor Author

/merge

@deepin-bot deepin-bot bot merged commit d2ccd58 into linuxdeepin:release/eagle Dec 3, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants