Use ButtonFocus and ButtonHover in PC3 RoundButton
This commit is contained in:
parent
c31edc876b
commit
89b7d0afb5
@ -52,6 +52,8 @@ T.RoundButton {
|
|||||||
background: Item {
|
background: Item {
|
||||||
opacity: control.enabled ? 1 : 0.6
|
opacity: control.enabled ? 1 : 0.6
|
||||||
|
|
||||||
|
// Round Button
|
||||||
|
|
||||||
PlasmaCore.Svg {
|
PlasmaCore.Svg {
|
||||||
id: buttonSvg
|
id: buttonSvg
|
||||||
imagePath: "widgets/actionbutton"
|
imagePath: "widgets/actionbutton"
|
||||||
@ -87,27 +89,22 @@ T.RoundButton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normal Button
|
||||||
|
// TODO: Make round button always round?
|
||||||
|
|
||||||
|
readonly property bool useNormalButton: control.text.length > 0
|
||||||
|
|
||||||
Private.ButtonShadow {
|
Private.ButtonShadow {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: control.text.length > 0 && (!control.flat || control.hovered) && (!control.pressed || !control.checked)
|
showShadow: background.useNormalButton && !control.flat && (!control.pressed || !control.checked)
|
||||||
state: {
|
|
||||||
if (control.pressed) {
|
|
||||||
return "hidden"
|
|
||||||
} else if (control.hovered) {
|
|
||||||
return "hover"
|
|
||||||
} else if (control.activeFocus) {
|
|
||||||
return "focus"
|
|
||||||
} else {
|
|
||||||
return "shadow"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaCore.FrameSvgItem {
|
PlasmaCore.FrameSvgItem {
|
||||||
id: surfaceNormal
|
id: surfaceNormal
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
imagePath: "widgets/button"
|
imagePath: "widgets/button"
|
||||||
prefix: "normal"
|
prefix: "normal"
|
||||||
opacity: control.text.length > 0 && (!control.flat || control.hovered) && (!control.pressed || !control.checked) ? 1 : 0
|
opacity: background.useNormalButton && (!control.flat || control.hovered) && (!control.pressed || !control.checked) ? 1 : 0
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
duration: units.longDuration
|
duration: units.longDuration
|
||||||
@ -115,11 +112,22 @@ T.RoundButton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Private.ButtonFocus {
|
||||||
|
anchors.fill: parent
|
||||||
|
showFocus: background.useNormalButton && control.activeFocus && !control.pressed
|
||||||
|
}
|
||||||
|
|
||||||
|
Private.ButtonHover {
|
||||||
|
anchors.fill: parent
|
||||||
|
showHover: background.useNormalButton && control.hovered && !control.pressed
|
||||||
|
}
|
||||||
|
|
||||||
PlasmaCore.FrameSvgItem {
|
PlasmaCore.FrameSvgItem {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
imagePath: "widgets/button"
|
imagePath: "widgets/button"
|
||||||
prefix: "pressed"
|
prefix: "pressed"
|
||||||
visible: control.text.length > 0
|
visible: background.useNormalButton
|
||||||
opacity: control.checked || control.pressed ? 1 : 0
|
opacity: control.checked || control.pressed ? 1 : 0
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
OpacityAnimator {
|
OpacityAnimator {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user