feat(StatusIconButton): make highlighted and hovered colors configurable

This commit is contained in:
Pascal Precht 2020-12-04 11:32:59 +01:00 committed by Iuri Matias
parent 1971fe7ea1
commit c5fd5b1e4d

View File

@ -9,6 +9,9 @@ RoundButton {
property string type: "primary" property string type: "primary"
property color iconColor: Style.current.secondaryText property color iconColor: Style.current.secondaryText
property color highlightedIconColor: Style.current.blue
property color hoveredIconColor: Style.current.blue
property color highlightedBackgroundColor: Style.current.secondaryBackground
property color disabledColor: iconColor property color disabledColor: iconColor
property int iconRotation: 0 property int iconRotation: 0
@ -22,7 +25,14 @@ RoundButton {
return control.disabledColor return control.disabledColor
} }
return (hovered || highlighted) ? Style.current.blue : control.iconColor if (hovered) {
return control.hoveredIconColor
}
if (highlighted) {
return control.highlightedIconColor
}
return control.iconColor
} }
radius: Style.current.radius radius: Style.current.radius
@ -36,7 +46,7 @@ RoundButton {
if (type === "secondary") { if (type === "secondary") {
return "transparent" return "transparent"
} }
return hovered || highlighted ? Style.current.secondaryBackground : "transparent" return hovered || highlighted ? control.highlightedBackgroundColor : "transparent"
} }
radius: control.radius radius: control.radius
} }
@ -56,6 +66,7 @@ RoundButton {
rotation: control.iconRotation rotation: control.iconRotation
} }
ColorOverlay { ColorOverlay {
visible: control.visible
anchors.fill: iconImg anchors.fill: iconImg
source: iconImg source: iconImg
color: control.icon.color color: control.icon.color
@ -63,7 +74,6 @@ RoundButton {
smooth: true smooth: true
rotation: control.iconRotation rotation: control.iconRotation
} }
} }
MouseArea { MouseArea {