fix: prevent itemSpacing override in setBackgroundType#671
Merged
18202781743 merged 1 commit intolinuxdeepin:masterfrom Jul 23, 2025
Merged
fix: prevent itemSpacing override in setBackgroundType#67118202781743 merged 1 commit intolinuxdeepin:masterfrom
18202781743 merged 1 commit intolinuxdeepin:masterfrom
Conversation
1. Removed automatic itemSpacing adjustment in DListView::setBackgroundType 2. Added itemSpacing() method in DStyledItemDelegate to dynamically calculate spacing based on background type 3. Changed itemSpacing member to spacing with default value -1 to indicate custom spacing 4. Updated all references to use the new itemSpacing() method The changes prevent the itemSpacing value from being unintentionally overwritten when setting backgroundType, while maintaining backward compatibility with the default spacing values for different background types. This gives more control to developers to set custom spacing values that won't be overridden by background type changes. fix: 修复设置背景类型时覆盖itemSpacing值的问题 1. 移除了DListView::setBackgroundType中自动调整itemSpacing的逻辑 2. 在DStyledItemDelegate中添加itemSpacing()方法根据背景类型动态计算间距 3. 将itemSpacing成员改为spacing并设置默认值-1表示自定义间距 4. 更新所有引用以使用新的itemSpacing()方法 这些修改防止了在设置backgroundType时意外覆盖itemSpacing值的问题,同时保 持了对不同背景类型默认间距值的向后兼容性。这为开发者提供了更多控制权,可 以设置不会被背景类型更改覆盖的自定义间距值。
deepin-ci-robot
added a commit
to linuxdeepin/dtk6widget
that referenced
this pull request
Jul 23, 2025
Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: linuxdeepin/dtkwidget#671
Contributor
deepin pr auto review代码审查意见:
综上所述,建议对代码进行重构,以确保逻辑的一致性,并提高代码的可读性和性能。同时,更新注释和文档,以反映代码的变化。 |
Contributor
|
Note
详情{
"src/widgets/dstyleditemdelegate.cpp": [
{
"line": " \brief 设置项 item 的集合列表 \a list, 只显示有 text 的 DViewItemActionList 集合",
"line_number": 1542,
"rule": "C128",
"reason": "政治敏感词 | b231f13999"
}
]
} |
mhduiy
approved these changes
Jul 23, 2025
xionglinlin
approved these changes
Jul 23, 2025
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy, xionglinlin 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 |
18202781743
pushed a commit
to linuxdeepin/dtk6widget
that referenced
this pull request
Jul 23, 2025
Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: linuxdeepin/dtkwidget#671
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.
DListView::setBackgroundType
calculate spacing based on background type
indicate custom spacing
The changes prevent the itemSpacing value from being unintentionally
overwritten when setting backgroundType, while maintaining backward
compatibility with the default spacing values for different background
types. This gives more control to developers to set custom spacing
values that won't be overridden by background type changes.
fix: 修复设置背景类型时覆盖itemSpacing值的问题
这些修改防止了在设置backgroundType时意外覆盖itemSpacing值的问题,同时保
持了对不同背景类型默认间距值的向后兼容性。这为开发者提供了更多控制权,可
以设置不会被背景类型更改覆盖的自定义间距值。