Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkdeclarative
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#444
  • Loading branch information
deepin-ci-robot committed Dec 30, 2024
1 parent 2f5efa5 commit bdd6f74
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 35 deletions.
64 changes: 44 additions & 20 deletions qt6/src/qml/BoxPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Item {
property D.Palette color2: DS.Style.button.background2
property D.Palette insideBorderColor: DS.Style.button.insideBorder
property D.Palette outsideBorderColor: DS.Style.button.outsideBorder
property D.Palette dropShadowColor: DS.Style.button.dropShadow
property D.Palette dropShadowColor0: DS.Style.button.dropShadow0
property D.Palette dropShadowColor1: DS.Style.button.dropShadow1
property D.Palette dropShadowColor2: DS.Style.button.dropShadow2
property D.Palette innerShadowColor1: DS.Style.button.innerShadow1
property D.Palette innerShadowColor2: DS.Style.button.innerShadow2
property int boxShadowBlur: 6
Expand All @@ -28,9 +30,31 @@ Item {
anchors.fill: backgroundRect
active: enableBoxShadow
sourceComponent: BoxShadow {
shadowBlur: control.boxShadowBlur
shadowOffsetY: control.boxShadowOffsetY
shadowColor: control.D.ColorSelector.dropShadowColor
shadowBlur: 2
shadowOffsetY: 0
shadowColor: control.D.ColorSelector.dropShadowColor0//"red"
cornerRadius: backgroundRect.radius
}
}

Loader {
anchors.fill: backgroundRect
active: enableBoxShadow
sourceComponent: BoxShadow {
shadowBlur: 2
shadowOffsetY: 1
shadowColor: control.D.ColorSelector.dropShadowColor1//"green"
cornerRadius: backgroundRect.radius
}
}

Loader {
anchors.fill: backgroundRect
active: enableBoxShadow
sourceComponent: BoxShadow {
shadowBlur: 2
shadowOffsetY: 2
shadowColor: control.D.ColorSelector.dropShadowColor2//"yellow"
cornerRadius: backgroundRect.radius
}
}
Expand Down Expand Up @@ -61,29 +85,29 @@ Item {
active: innerShadowColor1 && innerShadowColor.a !== 0 && control.D.ColorSelector.family === D.Palette.CommonColor
z: D.DTK.AboveOrder

sourceComponent: BoxInsetShadow {
shadowBlur: 2
shadowOffsetY: control.innerShadowOffsetY1
spread: 1
shadowColor: innerShadowColor
cornerRadius: backgroundRect.radius
}
}

Loader {
anchors.fill: backgroundRect
readonly property color innerShadowColor: control.D.ColorSelector.innerShadowColor2
active: innerShadowColor2 && innerShadowColor.a !== 0 && control.D.ColorSelector.family === D.Palette.CommonColor
z: D.DTK.AboveOrder

sourceComponent: BoxInsetShadow {
shadowBlur: 1
shadowOffsetY: 1
shadowColor: innerShadowColor
spread: 0
shadowColor: innerShadowColor // "red"
cornerRadius: backgroundRect.radius
}
}

// Loader {
// anchors.fill: backgroundRect
// readonly property color innerShadowColor: control.D.ColorSelector.innerShadowColor2
// active: innerShadowColor2 && innerShadowColor.a !== 0 && control.D.ColorSelector.family === D.Palette.CommonColor
// z: D.DTK.AboveOrder
//
// sourceComponent: BoxInsetShadow {
// shadowBlur: 1
// shadowOffsetY: 1
// shadowColor: "red"
// cornerRadius: backgroundRect.radius
// }
// }

Loader {
active: insideBorderColor
anchors.fill: backgroundRect
Expand Down
45 changes: 34 additions & 11 deletions qt6/src/qml/FlowStyle.qml
Original file line number Diff line number Diff line change
Expand Up @@ -96,56 +96,73 @@ QtObject {
// Button
property QtObject button: QtObject {
property int width: 140
property int height: 36
property int height: 30
property int hPadding: control.radius
property int vPadding: control.radius / 2.0
property int iconSize: 24

property D.Palette background1: D.Palette {
normal {
common: ("#f7f7f7")
common: ("#f5f5f5")
crystal: Qt.rgba(0, 0, 0, 0.1)
}
normalDark {
common: Qt.rgba(1, 1, 1, 0.1)
crystal: Qt.rgba(1, 1, 1, 0.1)
}
hovered {
common: ("#e1e1e1")
common: ("#e6e6e6")
crystal: Qt.rgba(16.0 / 255, 16.0 / 255, 16.0 / 255, 0.2)
}
pressed {
common: ("#bcc4d0")
common: ("#a9a9a9")
crystal: Qt.rgba(16.0 / 255, 16.0 / 255, 16.0 / 255, 0.15)
}
}

property D.Palette background2: D.Palette {
normal {
common: ("#f0f0f0")
common: ("#efefef")
crystal: Qt.rgba(0, 0, 0, 0.1)
}
normalDark {
common: Qt.rgba(1, 1, 1, 0.1)
crystal: Qt.rgba(1, 1, 1, 0.1)
}
hovered {
common: ("#d2d2d2")
common: ("#e6e6e6")
crystal: Qt.rgba(16.0 / 255, 16.0 / 255, 16.0 / 255, 0.2)
}
pressed {
common: ("#cdd6e0")
common: ("#cacaca")
crystal: Qt.rgba(16.0 / 255, 16.0 / 255, 16.0 / 255, 0.15)
}
}

property D.Palette dropShadow: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.05)
// YOffset: 0
property D.Palette dropShadow0: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.1)
hovered: Qt.rgba(0, 0, 0, 0.15)
pressed: Qt.rgba(0, 0, 0, 0.15)
}

// YOffset: 1
property D.Palette dropShadow1: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.1)
hovered: Qt.rgba(0, 0, 0, 0.1)
pressed: Qt.rgba(0, 0, 0, 0.08)
}

property D.Palette innerShadow1: D.Palette {
// YOffset: 2
property D.Palette dropShadow2: D.Palette {
normal: Qt.rgba(0, 0, 0, 0.05)
hovered: Qt.rgba(0, 0, 0, 0.05)
pressed: {"transparent"}
}

property D.Palette innerShadow1: D.Palette {
normal: Qt.rgba(1, 1, 1, 0.4)
hovered: Qt.rgba(1, 1, 1, 0.3)
pressed: ("transparent")
}

Expand Down Expand Up @@ -193,7 +210,7 @@ QtObject {
crystal: Qt.rgba(0, 0, 0, 1)
}
pressed {
common: D.DTK.makeColor(D.Color.Highlight)
common: Qt.rgba(0, 0, 0, 0.7)
crystal: D.DTK.makeColor(D.Color.Highlight)
}
}
Expand Down Expand Up @@ -353,6 +370,12 @@ QtObject {
}
}

property QtObject recommandButton: QtObject {
property D.Palette text: D.Palette {
normal: D.DTK.makeColor(D.Color.Highlight)
}
}

property QtObject switchButton: QtObject {
property int indicatorWidth: 50
property int indicatorHeight: 24
Expand Down
4 changes: 3 additions & 1 deletion qt6/src/qml/ListView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ ListView {
insideBorderColor: null
innerShadowColor1: null
innerShadowColor2: null
dropShadowColor: null
dropShadowColor0: null
dropShadowColor1: null
dropShadowColor2: null

visible: hoveredItem && !hoveredItem.checked && hoveredItem.enabled
color1: D.Palette {
Expand Down
2 changes: 1 addition & 1 deletion qt6/src/qml/RecommandButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import org.deepin.dtk.style 1.0 as DS
Button {
id: control

highlighted: true
textColor: DS.Style.recommandButton.text
}
6 changes: 4 additions & 2 deletions qt6/src/qml/private/ButtonPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ BoxPanel {
color2: selectValue(DS.Style.button.background2, DS.Style.checkedButton.background, DS.Style.highlightedButton.background2)
insideBorderColor: selectValue(DS.Style.button.insideBorder, null, DS.Style.highlightedButton.border)
outsideBorderColor: selectValue(DS.Style.button.outsideBorder, null, null)
dropShadowColor: selectValue(DS.Style.button.dropShadow, DS.Style.checkedButton.dropShadow, DS.Style.highlightedButton.dropShadow)
dropShadowColor0: selectValue(DS.Style.button.dropShadow0, DS.Style.checkedButton.dropShadow, DS.Style.highlightedButton.dropShadow)
dropShadowColor1: selectValue(DS.Style.button.dropShadow1, DS.Style.checkedButton.dropShadow, DS.Style.highlightedButton.dropShadow)
dropShadowColor2: selectValue(DS.Style.button.dropShadow2, DS.Style.checkedButton.dropShadow, DS.Style.highlightedButton.dropShadow)
innerShadowColor1: selectValue(DS.Style.button.innerShadow1, DS.Style.checkedButton.innerShadow, DS.Style.highlightedButton.innerShadow1)
innerShadowColor2: selectValue(DS.Style.button.innerShadow2, null, DS.Style.highlightedButton.innerShadow2)
boxShadowBlur: selectValue(control.D.ColorSelector.controlState === D.DTK.PressedState ? 4 : 6, 6, 4)
Expand Down Expand Up @@ -47,7 +49,7 @@ BoxPanel {
Gradient {
id: hoverBackgroundGradient
GradientStop { position: 0.0; color: control.D.ColorSelector.color1 }
GradientStop { position: 0.96; color: control.D.ColorSelector.color2 }
GradientStop { position: 1.0; color: control.D.ColorSelector.color2 }
}

CicleSpreadAnimation {
Expand Down

0 comments on commit bdd6f74

Please sign in to comment.