9import QtQuick.Templates as T
10import org.kde.ksvg as KSvg
12import org.kde.plasma.core as PlasmaCore
13import org.kde.kirigami as Kirigami
14import "private" as Private
19 Accessible.role: Accessible.Button
21 implicitWidth: Math.max(
Kirigami.Units.gridUnit, contentItem.implicitWidth)
22 + leftPadding + rightPadding
23 implicitHeight: Math.max(
Kirigami.Units.gridUnit, contentItem.implicitHeight)
24 + topPadding + bottomPadding
26 leftPadding: text.length > 0 ? surfaceNormal.margins.left : contentItem.extraSpace
27 topPadding: text.length > 0 ? surfaceNormal.margins.top : contentItem.extraSpace
28 rightPadding: text.length > 0 ? surfaceNormal.margins.right : contentItem.extraSpace
29 bottomPadding: text.length > 0 ? surfaceNormal.margins.bottom : contentItem.extraSpace
31 hoverEnabled: !
Kirigami.Settings.tabletMode
36 contentItem: RowLayout {
38 readonly
property int extraSpace: implicitWidth / 2 - implicitWidth / 2 * Math.sqrt(2) / 2 +
Kirigami.Units.smallSpacing
40 Layout.preferredWidth:
Kirigami.Units.iconSizes.smallMedium
41 Layout.preferredHeight:
Kirigami.Units.iconSizes.smallMedium
42 Layout.fillWidth:
true
43 Layout.fillHeight:
true
44 visible: source.length > 0
45 source: control.icon ? (control.icon.name || control.icon.source) :
""
48 visible: text.length > 0
51 opacity: enabled || control.highlighted || control.checked ? 1 : 0.4
53 horizontalAlignment: Text.AlignHCenter
54 verticalAlignment: Text.AlignVCenter
55 elide: Text.ElideRight
62 opacity: control.enabled ? 1 : 0.6
68 imagePath:
"widgets/actionbutton"
74 visible: !control.flat || control.activeFocus || control.highlighted
79 }
else if (control.hovered) {
81 }
else if (control.activeFocus || control.highlighted) {
92 elementId: (control.down || control.checked) ?
"pressed" :
"normal"
95 opacity: (control.down || control.checked || !control.flat || (roundShadow.hasOverState && control.hovered)) ? 1 : 0
97 enabled:
Kirigami.Units.longDuration > 0
98 PropertyAnimation { duration:
Kirigami.Units.longDuration }
105 readonly
property bool useNormalButton: control.text.length > 0
107 Private.ButtonShadow {
109 showShadow: backgroundItem.useNormalButton && !control.flat && (!control.down || !control.checked)
115 imagePath:
"widgets/button"
117 opacity: backgroundItem.useNormalButton && (!control.flat || control.hovered) && (!control.down || !control.checked) ? 1 : 0
118 Behavior on opacity {
119 enabled:
Kirigami.Units.longDuration > 0
121 duration:
Kirigami.Units.longDuration
122 easing.type: Easing.InOutQuad
127 Private.ButtonFocus {
129 showFocus: backgroundItem.useNormalButton && control.activeFocus && !control.down
132 Private.ButtonHover {
134 showHover: backgroundItem.useNormalButton && control.hovered && !control.down
139 imagePath:
"widgets/button"
141 visible: backgroundItem.useNormalButton
142 opacity: control.checked || control.down ? 1 : 0
143 Behavior on opacity {
144 enabled:
Kirigami.Units.longDuration > 0
146 duration:
Kirigami.Units.longDuration
147 easing.type: Easing.InOutQuad