fix: improve QML compatibility and code quality - #740
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kt286 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 |
|
Hi @kt286. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Reviewer's GuideThis PR modernizes QML signal/slot usage, hardens null-safety around models and loaders, aligns animations and drag images with current QML APIs, replaces SystemPalette with DTK Palette-based colors, and cleans up unused or legacy code while updating copyrights to 2026. Flow diagram for null-safe album/artist hash list updatesflowchart TD
A[onAlbumDataChanged] --> B{moreMenu.albumData<br/>and moreMenu.albumData.musicinfos ?}
B -- no --> C[return]
B -- yes --> D[Build tmplist from albumData.musicinfos]
D --> E[ImportMenu.setHashList]
A2[onArtistDataChanged] --> B2{moreMenu.artistData<br/>and moreMenu.artistData.musicinfos ?}
B2 -- no --> C2[return]
B2 -- yes --> D2[Build tmplist from artistData.musicinfos]
D2 --> E2[ImportMenu.setHashList]
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, and left some high level feedback:
- In SideBarItemDelegate.qml,
foregroundColoris defined as a color but is assignedColorSelector.highlightedTextPalette/normalTextPalette(which are palettes), so you likely want to use a specific role from your palettes (e.g.highlightedTextPalette.normalvsnormalTextPalette.normal) to ensurepalette.buttonTextgets an actual color. - In SearchResultWindow.qml, the
onViewAlbumDatailshandler takes a parameter namedartistDatabut passes it toitemDoubleClicked, which is semantically confusing for album results; consider renaming this parameter toalbumDatato match the signal and avoid future misuses.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In SideBarItemDelegate.qml, `foregroundColor` is defined as a color but is assigned `ColorSelector.highlightedTextPalette` / `normalTextPalette` (which are palettes), so you likely want to use a specific role from your palettes (e.g. `highlightedTextPalette.normal` vs `normalTextPalette.normal`) to ensure `palette.buttonText` gets an actual color.
- In SearchResultWindow.qml, the `onViewAlbumDatails` handler takes a parameter named `artistData` but passes it to `itemDoubleClicked`, which is semantically confusing for album results; consider renaming this parameter to `albumData` to match the signal and avoid future misuses.
## Individual Comments
### Comment 1
<location path="src/music-player/musicbaseandsonglist/SideBarItemDelegate.qml" line_range="23-24" />
<code_context>
+ normal: Qt.rgba(255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0, 1)
+ normalDark: Qt.rgba(0, 0, 0, 1)
+ }
+ readonly property color foregroundColor: checked ? ColorSelector.highlightedTextPalette
+ : ColorSelector.normalTextPalette
id: item
checked: globalVariant !== undefined && globalVariant.curListPage === model.uuid
</code_context>
<issue_to_address>
**issue (bug_risk):** foregroundColor is bound to a palette object instead of an actual color
`foregroundColor` is declared as a `color` and used to derive `palette.buttonText`, but it’s now assigned `ColorSelector.highlightedTextPalette` / `normalTextPalette`, which are `Palette` objects, not colors. This is likely to fail or misrender. Bind to a concrete color (e.g. `highlightedTextPalette.normal` / `normalTextPalette.normal`) or the corresponding `ColorSelector` color property instead.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
14265ec to
c45dc7b
Compare
|
TAG Bot New tag: 7.0.63 |
|
TAG Bot New tag: 7.0.64 |
c45dc7b to
805ce8a
Compare
|
TAG Bot New tag: 7.0.65 |
|
TAG Bot New tag: 7.0.66 |
805ce8a to
3ca699f
Compare
- Update QML signal handlers to function syntax (Qt 6.x compat) - Add null checks for currentData/parent to prevent crashes - Update SPDX copyright year to 2026 - Replace hardcoded Chinese strings with qsTr for i18n - Remove commented-out dead code - Guard update() call in shaderdataview.cpp before component is ready fix: 修复 QML 兼容性问题并增强空值保护 - 更新 QML 信号处理语法为函数式写法 (Qt 6.x 兼容) - 添加多处 currentData/parent 空值检查,防止崩溃 - 更新 SPDX 许可证年份至 2026 - 修复硬编码中文字符串,使用 qsTr 国际化 - 移除冗余注释代码 - 修复 shaderdataview.cpp 组件未就绪时的 update 调用
3ca699f to
74aad82
Compare
改进 QML 兼容性和代码质量
解决了艺人歌曲列表中按钮错位
Summary by Sourcery
Improve QML music player stability and compatibility while cleaning up legacy code and styling.
Bug Fixes:
Enhancements:
Documentation:
Chores:
Summary by Sourcery
Improve QML compatibility and music player stability while correcting view interactions and cleaning up legacy code.
Bug Fixes:
Enhancements:
Documentation:
Chores: