feat(StatusBaseButton): introduce `Tiny` size

This commit is contained in:
Pascal Precht 2021-11-02 11:23:47 +01:00 committed by r4bbit.eth
parent f82cd7f52b
commit dee9f43761
1 changed files with 28 additions and 3 deletions

View File

@ -7,6 +7,7 @@ Rectangle {
id: statusBaseButton id: statusBaseButton
enum Size { enum Size {
Tiny,
Small, Small,
Large Large
} }
@ -33,8 +34,32 @@ Rectangle {
property real defaultLeftPadding: size === StatusBaseButton.Size.Large ? 24 : 12 property real defaultLeftPadding: size === StatusBaseButton.Size.Large ? 24 : 12
property real defaultRightPadding: size === StatusBaseButton.Size.Large ? 24 : 12 property real defaultRightPadding: size === StatusBaseButton.Size.Large ? 24 : 12
property real defaultTopPadding: size === StatusBaseButton.Size.Large ? 11 : 10 property real defaultTopPadding: {
property real defaultBottomPadding: size === StatusBaseButton.Size.Large ? 11 : 10 switch (size) {
case StatusBaseButton.Size.Tiny:
return 5
case StatusBaseButton.Size.Small:
return 10
break;
case StatusBaseButton.Size.Large:
default:
return 11
break;
}
}
property real defaultBottomPadding: {
switch (size) {
case StatusBaseButton.Size.Tiny:
return 5
case StatusBaseButton.Size.Small:
return 10
break;
case StatusBaseButton.Size.Large:
default:
return 11
break;
}
}
property real leftPadding: defaultLeftPadding property real leftPadding: defaultLeftPadding
@ -62,7 +87,7 @@ Rectangle {
implicitWidth: sensor.width implicitWidth: sensor.width
implicitHeight: sensor.height implicitHeight: sensor.height
radius: 8 radius: size !== StatusBaseButton.Size.Tiny ? 8 : 6
color: { color: {
if (statusBaseButton.enabled) { if (statusBaseButton.enabled) {