Repository navigation
fix(scrollbar): refine width, radius, opacity for per-state styling - #758
Conversation
Refactor ScrollBar to distinguish vertical and horizontal widths, fix opacity values, and use dedicated radius tokens instead of dynamic height/2 or width/2. Style tokens (qt6/src/qml/FlowStyle.qml): - Vertical width 4 -> 6; add horizontalWidth: 4 for slimmer horizontal bars - Add hoverWidth: 14 and horizontalHoverWidth: 12 for orientation-aware hover sizing (previously both used activeWidth: 12) - Add normalRadius: 4 (hide/normal) and radius: 6 (hover/pressed), replacing dynamic height/2 or width/2 - Background opacity: normal 0.3 -> 0.5, hovered 0.4 -> 0.7; hoveredDark 0.6 -> 0.7 - insideBorder: normalDark 0.1 -> 0.05; add hoveredDark (0.1) and pressedDark (0.05) Control (qt6/src/qml/ScrollBar.qml): - hide / normal / hover states use orientation-aware width tokens - pressed (active) state keeps activeWidth: 12; with 1px border on each side the visual width is 14, matching hover - All four states now drive backgroundRect.radius: normalRadius (4) for hide/normal, radius (6) for hover/pressed, replacing the old dynamic height/2 / width/2 - contentItem.implicitWidth default is orientation-aware Exhibition demo (examples/exhibition/ScrollBar.qml): - Add theme-aware border and content background colors via ApplicationHelper.n so scrollbars are visible in both light and dark modes - Fix "D is not defined" ReferenceError by replacing D.DTK.themeType / D.ApplicationHelper with correct unqualified QML references 重构 ScrollBar 样式,区分垂直和水平方向宽度,修正透明度,并使用独立的 圆角参数替代动态的 height/2 / width/2。 样式参数 (qt6/src/qml/FlowStyle.qml): - 垂直宽度 4 -> 6;新增 horizontalWidth: 4,水平滚动条保持纤细 - 新增 hoverWidth: 14 和 horizontalHoverWidth: 12,区分方向的 hover 宽度 (之前统一用 activeWidth: 12) - 新增 normalRadius: 4(隐藏/正常态)和 radius: 6(hover/pressed 态), 取代动态的 height/2 / width/2 - 背景透明度:normal 0.3 -> 0.5,hover 0.4 -> 0.7;hoveredDark 0.6 -> 0.7 - insideBorder:normalDark 0.1 -> 0.05;新增 hoveredDark (0.1) 和 pressedDark (0.05) 控件 (qt6/src/qml/ScrollBar.qml): - 隐藏 / 正常 / hover 状态使用方向感知的宽度参数 - pressed(active)状态保持 activeWidth: 12;加上两侧各 1px 外描边, 视觉宽度为 14,与 hover 一致 - 四个状态均驱动 backgroundRect.radius:隐藏/正常用 normalRadius (4), hover/pressed 用 radius (6),取代旧的动态 height/2 / width/2 - contentItem.implicitWidth 默认值改为方向感知 Exhibition 示例 (examples/exhibition/ScrollBar.qml): - 通过 ApplicationHelper.n 添加主题感知的边框色和内容背景色,浅色和深色 模式下都能清楚看到滚动条 - 修复 D is not defined 的 ReferenceError,将 D.DTK.themeType / D.ApplicationHelper 替换为正确的无前缀 QML 引用
|
Hi @zqq-dora. 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 GuideUIDefine the per-orientation scrollbar widths, state radii, and palette values, then apply those tokens to the corresponding control states and default content width.
Make the exhibition scrollbar examples visible in both themes and use the unqualified application helper for theme detection.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="qt6/src/qml/FlowStyle.qml" line_range="1057" />
<code_context>
+ property int width: 6
+ property int horizontalWidth: 4
property int activeWidth: 12
+ property int hoverWidth: 14
+ property int horizontalHoverWidth: 12
+ property int normalRadius: 4
</code_context>
<issue_to_address>
**Scrollbar narrows when pressed**
When a vertical scrollbar transitions from hover to pressed, `FlowStyle.hoverWidth` is 14 while `activeWidth` is 12, and `OutsideBoxBorder` adds 1 px on each side in both states, so the visible scrollbar shrinks from 16 px to 14 px when pressed.
Set `hoverWidth` to 12 so it matches `activeWidth`.
Also at `qt6/src/qml/ScrollBar.qml:83-84`.
</issue_to_address>
### Comment 2
<location path="examples/exhibition/ScrollBar.qml" line_range="11" />
<code_context>
Column {
id: panel
+
+ property bool darkMode: ApplicationHelper.n === ApplicationHelper.DarkType
+ property color borderColor: darkMode ? "#3d3d3d" : "#cacaca"
+ property color contentBgColor: darkMode ? "#2a2a2a" : "#f5f5f5"
</code_context>
<issue_to_address>
**Demo stays light in dark mode**
When the exhibition is shown in dark mode, `ApplicationHelper.n` is not a theme property, so `darkMode` stays false and `borderColor` and `contentBgColor` retain their light colors.
Bind `darkMode` to the registered `ApplicationHelper` singleton’s actual current-theme property.
</issue_to_address>| property int width: 6 | ||
| property int horizontalWidth: 4 | ||
| property int activeWidth: 12 | ||
| property int hoverWidth: 14 |
There was a problem hiding this comment.
🟡 Medium · Scrollbar narrows when pressed
When a vertical scrollbar transitions from hover to pressed, FlowStyle.hoverWidth is 14 while activeWidth is 12, and OutsideBoxBorder adds 1 px on each side in both states, so the visible scrollbar shrinks from 16 px to 14 px when pressed.
Set hoverWidth to 12 so it matches activeWidth.
Also at qt6/src/qml/ScrollBar.qml:83-84.
Prompt for AI agents
In `qt6/src/qml/FlowStyle.qml` at line 1057:
**Scrollbar narrows when pressed**
When a vertical scrollbar transitions from hover to pressed, `FlowStyle.hoverWidth` is 14 while `activeWidth` is 12, and `OutsideBoxBorder` adds 1 px on each side in both states, so the visible scrollbar shrinks from 16 px to 14 px when pressed.
Set `hoverWidth` to 12 so it matches `activeWidth`.
Also at `qt6/src/qml/ScrollBar.qml:83-84`.| Column { | ||
| id: panel | ||
|
|
||
| property bool darkMode: ApplicationHelper.n === ApplicationHelper.DarkType |
There was a problem hiding this comment.
🟡 Medium · Demo stays light in dark mode
When the exhibition is shown in dark mode, ApplicationHelper.n is not a theme property, so darkMode stays false and borderColor and contentBgColor retain their light colors.
Bind darkMode to the registered ApplicationHelper singleton’s actual current-theme property.
Prompt for AI agents
In `examples/exhibition/ScrollBar.qml` at line 11:
**Demo stays light in dark mode**
When the exhibition is shown in dark mode, `ApplicationHelper.n` is not a theme property, so `darkMode` stays false and `borderColor` and `contentBgColor` retain their light colors.
Bind `darkMode` to the registered `ApplicationHelper` singleton’s actual current-theme property.|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, zqq-dora 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 |
9738224
into
linuxdeepin:v25-flowstyle
Refactor ScrollBar to distinguish vertical and horizontal widths, fix opacity values, and use dedicated radius tokens instead of dynamic height/2 or width/2.
Style tokens (qt6/src/qml/FlowStyle.qml):
horizontalWidth: 4for slimmer horizontal barshoverWidth: 14andhorizontalHoverWidth: 12for orientation-aware hover sizing (previously both usedactiveWidth: 12)normalRadius: 4(hide/normal) andradius: 6(hover/pressed), replacing dynamicheight/2orwidth/2Control (qt6/src/qml/ScrollBar.qml):
activeWidth: 12; with 1px border on each side the visual width is 14, matching hoverbackgroundRect.radius:normalRadius(4) for hide/normal,radius(6) for hover/pressed, replacing the old dynamicheight/2/width/2contentItem.implicitWidthdefault is orientation-awareExhibition demo (examples/exhibition/ScrollBar.qml):
ApplicationHelper.nso scrollbars are visible in both light and dark modesD is not definedReferenceError by replacingD.DTK.themeType/D.ApplicationHelperwith correct unqualified QML references重构 ScrollBar 样式,区分垂直和水平方向宽度,修正透明度,并使用独立的圆角参数替代动态的
height/2/width/2。样式参数 (qt6/src/qml/FlowStyle.qml):
horizontalWidth: 4,水平滚动条保持纤细hoverWidth: 14和horizontalHoverWidth: 12,区分方向的 hover 宽度(之前统一用activeWidth: 12)normalRadius: 4(隐藏/正常态)和radius: 6(hover/pressed 态),取代动态的height/2/width/2控件 (qt6/src/qml/ScrollBar.qml):
activeWidth: 12;加上两侧各 1px 外描边,视觉宽度为 14,与 hover 一致backgroundRect.radius:隐藏/正常用normalRadius(4),hover/pressed 用radius(6),取代旧的动态height/2/width/2contentItem.implicitWidth默认值改为方向感知Exhibition 示例 (examples/exhibition/ScrollBar.qml):
ApplicationHelper.n添加主题感知的边框色和内容背景色,浅色和深色模式下都能清楚看到滚动条D is not defined的 ReferenceError,将D.DTK.themeType/D.ApplicationHelper替换为正确的无前缀 QML 引用Summary by Sourcery
Refine scrollbar dimensions, opacity, borders, and radii for consistent per-state and orientation-aware styling.
Bug Fixes:
Enhancements: