diff --git a/examples/exhibition/ScrollBar.qml b/examples/exhibition/ScrollBar.qml index 2d8e5ad2..a5add7f8 100644 --- a/examples/exhibition/ScrollBar.qml +++ b/examples/exhibition/ScrollBar.qml @@ -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 @@ -7,6 +7,11 @@ import org.deepin.dtk 1.0 Column { id: panel + + property bool darkMode: ApplicationHelper.n === ApplicationHelper.DarkType + property color borderColor: darkMode ? "#3d3d3d" : "#cacaca" + property color contentBgColor: darkMode ? "#2a2a2a" : "#f5f5f5" + Label { width: parent.width wrapMode: Text.WordWrap @@ -21,7 +26,8 @@ Column { width: parent.width Rectangle { - border.color: "#cacaca" + border.color: panel.borderColor + color: panel.contentBgColor width: 300 height: 213 Flickable { @@ -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 diff --git a/qt6/src/qml/FlowStyle.qml b/qt6/src/qml/FlowStyle.qml index 32b21c55..6ed36467 100644 --- a/qt6/src/qml/FlowStyle.qml +++ b/qt6/src/qml/FlowStyle.qml @@ -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 + 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) @@ -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) } } diff --git a/qt6/src/qml/ScrollBar.qml b/qt6/src/qml/ScrollBar.qml index 13d4ee18..a9afcb80 100644 --- a/qt6/src/qml/ScrollBar.qml +++ b/qt6/src/qml/ScrollBar.qml @@ -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,16 +55,24 @@ 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 { @@ -72,7 +80,11 @@ T.ScrollBar { 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 }