9import QtQuick.Templates as T
10import org.kde.kirigami as Kirigami
11import "private" as Private
16 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
17 implicitContentWidth + leftPadding + rightPadding,
18 implicitIndicatorWidth + leftPadding + rightPadding)
19 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
20 implicitContentHeight + topPadding + bottomPadding,
21 implicitIndicatorHeight + topPadding + bottomPadding)
23 baselineOffset: contentItem.y + contentItem.baselineOffset
27 icon.width:
Kirigami.Units.iconSizes.sizeForLabels
28 icon.height:
Kirigami.Units.iconSizes.sizeForLabels
30 Kirigami.MnemonicData.enabled: enabled && visible
35 enabled: !(RegExp(/\&[^\&]/).test(control.text))
36 sequence: control.Kirigami.MnemonicData.sequence
37 onActivated: control.animateClick()
41 x: (control.text || control.icon.name || control.icon.source)
42 ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding)
43 : control.leftPadding + Math.round((control.availableWidth - width) / 2)
44 y: control.topPadding + Math.round((control.availableHeight - height) / 2)
49 contentItem: Private.IconLabel {
52 readonly
property int effectiveIndicatorWidth: control.indicator && control.indicator.visible && control.indicator.width > 0
53 ? control.indicator.width + control.spacing : 0
55 mirrored: control.mirrored
56 leftPadding: !control.mirrored ? effectiveIndicatorWidth : 0
57 rightPadding: control.mirrored ? effectiveIndicatorWidth : 0
60 alignment:
Qt.AlignLeft |
Qt.AlignVCenter
61 display: control.display
62 spacing: control.spacing
63 iconItem.implicitWidth: control.icon.width
64 iconItem.implicitHeight: control.icon.height
65 iconItem.source: control.icon.name || control.icon.source
66 label.text: control.Kirigami.MnemonicData.richTextLabel
69 parent: contentLabel.label
70 width: Math.min(parent.width, contentLabel.label.contentWidth)
72 anchors.left: parent.left
73 anchors.top: parent.bottom
75 visible: control.visualFocus