fix(titlebar): 使用 DTK 调色板和标准按钮状态色 - #329
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: F-windy 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 |
|
Warning
详情 {
"export": {
"debian/rules": {
"a": [
"export QT_SELECT=5"
],
"b": [
"export QT_SELECT=6"
]
}
}
} |
Reviewer's GuideAligns deepin-image-viewer’s titlebar window buttons and menu with DTK visual and palette standards, fixes pressed/hovered color behavior, removes a duplicated window button group, ensures the ApplicationWindow uses the DTK palette, and updates Debian rules to use the Qt6 toolchain. 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 left some high level feedback:
- Now that both
import org.deepin.dtk 1.0andimport org.deepin.dtk 1.0 as Dare present inViewTopTitle.qml, consider consistently using the aliasedD.*types (or dropping the unaliased import) to avoid ambiguity about which namespace should be used for new DTK components going forward. - The
defaultTextColorandscaledTextColorpalettes inViewTopTitle.qmlboth hardcode similar rgba values for normal/hovered states; consider extracting shared color constants or using an existing DTK style helper (e.g., fromDS.Style) to reduce duplication and keep the hover/press behavior aligned with any future DTK palette changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Now that both `import org.deepin.dtk 1.0` and `import org.deepin.dtk 1.0 as D` are present in `ViewTopTitle.qml`, consider consistently using the aliased `D.*` types (or dropping the unaliased import) to avoid ambiguity about which namespace should be used for new DTK components going forward.
- The `defaultTextColor` and `scaledTextColor` palettes in `ViewTopTitle.qml` both hardcode similar rgba values for normal/hovered states; consider extracting shared color constants or using an existing DTK style helper (e.g., from `DS.Style`) to reduce duplication and keep the hover/press behavior aligned with any future DTK palette changes.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
7c9d8c3 to
7cabf75
Compare
|
Warning
详情 {
"export": {
"debian/rules": {
"a": [
"export QT_SELECT=5"
],
"b": [
"export QT_SELECT=6"
]
}
}
} |
7cabf75 to
f1d1eb7
Compare
|
Warning
详情 {
"export": {
"debian/rules": {
"a": [
"export QT_SELECT=5"
],
"b": [
"export QT_SELECT=6"
]
}
}
} |
1. Add D alias import and prefix menu controls with D. in ViewTopTitle 2. Add hovered/pressed palette branches to window button text color 3. Set palette: DTK.palette on ApplicationWindow to fix ColorSelector 4. Split window flags into separate button hints Log: Fix DTK window button color states and menu control binding Influence: Window buttons render DTK standard colors on hover and press fix(titlebar): 使用 DTK 调色板和标准按钮状态色 1. ViewTopTitle 添加 D 别名导入,菜单控件统一加 D. 前缀 2. 窗口按钮 textColor Palette 补充 hovered/pressed 状态分支 3. ApplicationWindow 设置 palette: DTK.palette 修复 ColorSelector 上下文 4. 拆分窗口 flags 为独立按钮 Hint Log: 修复 DTK 窗口按钮状态色和菜单控件绑定 PMS: BUG-372811 Influence: 窗口按钮 hover/press 态按 DTK 标准着色
f1d1eb7 to
a4d842a
Compare
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 --- a/src/qml/ViewTopTitle.qml
+++ b/src/qml/ViewTopTitle.qml
@@ -10,6 +10,11 @@ import org.deepin.dtk.style 1.0 as DS
import org.deepin.image.viewer 1.0 as IV
// 防御性检查:确保 DTK 核心对象可用,避免在非标准环境下出现属性未定义的运行时错误
+Component.onCompleted: {
+ if (typeof D.DTK === "undefined" || typeof D.DTK.makeColor !== "function") {
+ console.warn("DTK core module or makeColor function is unavailable, fallback to static color");
+ }
+}
Rectangle {
id: titlebar |
|
TAG Bot New tag: 6.0.48 |
变更内容
本 PR 修复 deepin-image-viewer 窗口按钮的 DTK 调色板状态缺失问题,使按钮 hover/press 态按 DTK 标准着色。
src/qml/ViewTopTitle.qmlimport org.deepin.dtk 1.0 as D别名导入,菜单控件 (Menu/Action/MenuSeparator/ThemeMenu/HelpAction/AboutAction/QuitAction) 统一加D.前缀,绑定到 DTK 控件defaultTextColor/scaledTextColorPalette 补充hovered/hoveredDark/pressed/pressedDark分支:D.DTK.makeColor(D.Color.Highlight)(DTK 强调色蓝)src/qml/main.qmlApplicationWindow添加palette: DTK.palette,使窗口按钮 DCI 图标的ColorSelector上下文正确,按 press/hover 状态渲染 DTK 标准色flags由Qt.WindowMinMaxButtonsHint拆分为Qt.WindowMinimizeButtonHint | Qt.WindowMaximizeButtonHint,语义更明确uos-design: allow-overlay-titlebar豁免注释关联
PMS: BUG-372811