Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions examples/exhibition/ScrollBar.qml
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

Expand All @@ -7,6 +7,11 @@ import org.deepin.dtk 1.0

Column {
id: panel

property bool darkMode: ApplicationHelper.n === ApplicationHelper.DarkType

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

property color borderColor: darkMode ? "#3d3d3d" : "#cacaca"
property color contentBgColor: darkMode ? "#2a2a2a" : "#f5f5f5"

Label {
width: parent.width
wrapMode: Text.WordWrap
Expand All @@ -21,7 +26,8 @@ Column {
width: parent.width

Rectangle {
border.color: "#cacaca"
border.color: panel.borderColor
color: panel.contentBgColor
width: 300
height: 213
Flickable {
Expand All @@ -44,14 +50,15 @@ Column {
}
}

Item { width: parent.width; height: 1}
Item { width: parent.width; height: 1 }

Rectangle {
id: frame
clip: true
width: 1000
height: 278
border.color: "black"
border.color: panel.borderColor
color: panel.contentBgColor
Rectangle {
id: content
width: 450
Expand Down
18 changes: 13 additions & 5 deletions qt6/src/qml/FlowStyle.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1051,19 +1051,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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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`.

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)
Expand All @@ -1076,7 +1081,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)
}
}

Expand Down
28 changes: 22 additions & 6 deletions qt6/src/qml/ScrollBar.qml
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

Expand Down Expand Up @@ -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
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 {
Expand All @@ -82,6 +94,10 @@ T.ScrollBar {
target: control.contentItem
implicitWidth: DS.Style.scrollBar.activeWidth
}
PropertyChanges {
target: backgroundRect
radius: DS.Style.scrollBar.radius
}
}
]

Expand All @@ -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
}

Expand Down
Loading