feat(StatusRoundButton): add `highlighted` and `icon.rotation` props

These are needed for some UIs where the icon state may change based on the
user's interaction.
This commit is contained in:
Pascal Precht 2021-06-14 13:21:25 +02:00 committed by Pascal Precht
parent 59b40c0713
commit 7c16a9bd3d
1 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,7 @@ Rectangle {
property StatusIconSettings icon: StatusIconSettings { property StatusIconSettings icon: StatusIconSettings {
width: 23 width: 23
height: 23 height: 23
rotation: 0
color: { color: {
switch(statusRoundButton.type) { switch(statusRoundButton.type) {
@ -34,6 +35,8 @@ Rectangle {
property alias hovered: sensor.containsMouse property alias hovered: sensor.containsMouse
property bool highlighted: false
property int type: StatusRoundButton.Type.Primary property int type: StatusRoundButton.Type.Primary
signal pressed(var mouse) signal pressed(var mouse)
@ -87,7 +90,7 @@ Rectangle {
color: { color: {
if (statusRoundButton.enabled) { if (statusRoundButton.enabled) {
return sensor.containsMouse ? backgroundSettings.hoverColor return sensor.containsMouse || highlighted ? backgroundSettings.hoverColor
: backgroundSettings.color : backgroundSettings.color
} else { } else {
return backgroundSettings.disabledColor return backgroundSettings.disabledColor
@ -109,6 +112,7 @@ Rectangle {
visible: !loading visible: !loading
icon: statusRoundButton.icon.name icon: statusRoundButton.icon.name
rotation: statusRoundButton.icon.rotation
width: statusRoundButton.icon.width width: statusRoundButton.icon.width
height: statusRoundButton.icon.height height: statusRoundButton.icon.height