Repository navigation
fix(scrollbar): refine width, radius, opacity for per-state styling #757
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -852,19 +852,24 @@ QtObject { | |
| // Bar | ||
| property QtObject scrollBar: QtObject { | ||
| property int padding: 2 | ||
| property int width: 4 | ||
| property int width: 6 | ||
| property int horizontalWidth: 4 | ||
| property int activeWidth: 12 | ||
| property int hoverWidth: 14 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium · Scrollbar narrows on press When a vertical scrollbar transitions from hover to pressed, the hover state uses Set the vertical pressed width to match the hover width. Also at Prompt for AI agentsIn `qt6/src/qml/FlowStyle.qml` at line 858:
**Scrollbar narrows on press**
When a vertical scrollbar transitions from hover to pressed, the hover state uses `hoverWidth` 14 while the pressed state uses `activeWidth` 12; `OutsideBoxBorder` adds 1px on each side, so the bar goes from 16px to 14px and visibly narrows on press.
Set the vertical pressed width to match the hover width.
Also at `qt6/src/qml/ScrollBar.qml:83`. |
||
| property int horizontalHoverWidth: 12 | ||
| property int normalRadius: 4 | ||
| property real hideOpacity: 0.0 | ||
| property int hidePauseDuration: 450 | ||
| property int hideDuration: 1500 | ||
| property int hideWidthDuration: 100 | ||
| property int radius: 6 | ||
|
|
||
| property D.Palette background: D.Palette { | ||
| normal: Qt.rgba(0, 0, 0, 0.3) | ||
| normal: Qt.rgba(0, 0, 0, 0.5) | ||
| normalDark: Qt.rgba(1, 1, 1, 0.3) | ||
|
|
||
| hovered: Qt.rgba(0, 0, 0, 0.4) | ||
| hoveredDark: Qt.rgba(1, 1, 1, 0.6) | ||
| hovered: Qt.rgba(0, 0, 0, 0.7) | ||
| hoveredDark: Qt.rgba(1, 1, 1, 0.7) | ||
|
|
||
| pressed: Qt.rgba(0, 0, 0, 0.4) | ||
| pressedDark: Qt.rgba(1, 1, 1, 0.3) | ||
|
|
@@ -877,7 +882,10 @@ QtObject { | |
|
|
||
| property D.Palette insideBorder: D.Palette { | ||
| normal: Qt.rgba(0, 0, 0, 0.05) | ||
| normalDark: Qt.rgba(1, 1, 1, 0.1) | ||
| normalDark: Qt.rgba(1, 1, 1, 0.05) | ||
|
|
||
| hoveredDark: Qt.rgba(1, 1, 1, 0.1) | ||
| pressedDark: Qt.rgba(1, 1, 1, 0.05) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. | ||
| // SPDX-FileCopyrightText: 2022-2026 UnionTech Software Technology Co., Ltd. | ||
| // | ||
| // SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
|
||
|
|
@@ -55,24 +55,36 @@ T.ScrollBar { | |
| when: __currentState === 0 | ||
| PropertyChanges { | ||
| target: control.contentItem | ||
| implicitWidth: DS.Style.scrollBar.width | ||
| implicitWidth: control.orientation == Qt.Horizontal ? DS.Style.scrollBar.horizontalWidth : DS.Style.scrollBar.width | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium · Older style overrides lose scrollbar sizing When an application supplies a style override based on the previous scroll-bar token set, a custom Provide backward-compatible fallbacks for the new tokens or preserve the old style shape when resolving scrollbar values. Also at Prompt for AI agentsIn `qt6/src/qml/ScrollBar.qml` at line 58:
**Older style overrides lose scrollbar sizing**
When an application supplies a style override based on the previous scroll-bar token set, a custom `DS.Style` based on the previous token set has no `horizontalWidth`, `hoverWidth`, or `normalRadius`; these bindings then read missing properties, leaving scrollbar dimensions or radii invalid and breaking rendering for applications using that override.
Provide backward-compatible fallbacks for the new tokens or preserve the old style shape when resolving scrollbar values.
Also at `qt6/src/qml/ScrollBar.qml:83`, `qt6/src/qml/ScrollBar.qml:125`. |
||
| opacity: DS.Style.scrollBar.hideOpacity | ||
| } | ||
| PropertyChanges { | ||
| target: backgroundRect | ||
| radius: DS.Style.scrollBar.normalRadius | ||
| } | ||
| }, | ||
| State { | ||
| name: "normal" | ||
| when: __currentState === 1 | ||
| PropertyChanges { | ||
| target: control.contentItem | ||
| implicitWidth: DS.Style.scrollBar.width | ||
| implicitWidth: control.orientation == Qt.Horizontal ? DS.Style.scrollBar.horizontalWidth : DS.Style.scrollBar.width | ||
| } | ||
| PropertyChanges { | ||
| target: backgroundRect | ||
| radius: DS.Style.scrollBar.normalRadius | ||
| } | ||
| }, | ||
| State { | ||
| name: "hover" | ||
| when: __currentState === 2 | ||
| PropertyChanges { | ||
| target: control.contentItem | ||
| implicitWidth: DS.Style.scrollBar.activeWidth | ||
| implicitWidth: control.orientation == Qt.Horizontal ? DS.Style.scrollBar.horizontalHoverWidth : DS.Style.scrollBar.hoverWidth | ||
| } | ||
| PropertyChanges { | ||
| target: backgroundRect | ||
| radius: DS.Style.scrollBar.radius | ||
| } | ||
| }, | ||
| State { | ||
|
|
@@ -82,6 +94,10 @@ T.ScrollBar { | |
| target: control.contentItem | ||
| implicitWidth: DS.Style.scrollBar.activeWidth | ||
| } | ||
| PropertyChanges { | ||
| target: backgroundRect | ||
| radius: DS.Style.scrollBar.radius | ||
| } | ||
| } | ||
| ] | ||
|
|
||
|
|
@@ -100,13 +116,13 @@ T.ScrollBar { | |
| property D.Palette insideBorderColor: DS.Style.scrollBar.insideBorder | ||
| property D.Palette outsideBorderColor: DS.Style.scrollBar.outsideBorder | ||
|
|
||
| implicitWidth: DS.Style.scrollBar.width | ||
| implicitWidth: control.orientation == Qt.Horizontal ? DS.Style.scrollBar.horizontalWidth : DS.Style.scrollBar.width | ||
| implicitHeight: implicitWidth | ||
|
|
||
| Rectangle { | ||
| id: backgroundRect | ||
| anchors.fill: parent | ||
| radius: control.orientation == Qt.Horizontal ? control.height / 2 : control.width / 2 | ||
| radius: DS.Style.scrollBar.normalRadius | ||
| color: content.D.ColorSelector.backgroundColor | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium · Demo keeps light-mode colors
When the exhibition is shown in dark mode,
ApplicationHelper.ndoes not expose the current theme, sodarkModeremains false andbgColor,borderColor, andcontentBgColorkeep their light-mode values; the demo's surfaces and scrollbar borders lose contrast.Bind
darkModeto the exposed theme property instead ofApplicationHelper.n.Prompt for AI agents