10import QtQuick.Templates as T
11import org.kde.kirigami as Kirigami
17 property int alignment: 0
18 property int effectiveHorizontalAlignment: !LayoutMirroring.enabled ? alignment
19 : (alignment & Qt.AlignLeft) ? Qt.AlignRight
20 : (alignment & Qt.AlignRight) ? Qt.AlignLeft
22 property int display: T.AbstractButton.TextBesideIcon
24 property alias iconItem: iconItem
25 property alias label: label
27 property real topPadding: 0
28 property real leftPadding: 0
29 property real rightPadding: 0
30 property real bottomPadding: 0
32 readonly property real availableWidth: width - leftPadding - rightPadding
33 readonly property real availableHeight: height - topPadding - bottomPadding
35 property real spacing: 0
42 property bool mirrored: false
44 implicitWidth: gridLayout.implicitWidth + leftPadding + rightPadding
45 implicitHeight: gridLayout.implicitHeight + topPadding + bottomPadding
50 rowSpacing: root.spacing
51 columnSpacing: root.spacing
52 flow: root.display === T.AbstractButton.TextUnderIcon ? GridLayout.TopToBottom : GridLayout.LeftToRight
57 LayoutMirroring.enabled: root.mirrored
59 if (root.effectiveHorizontalAlignment & Qt.AlignLeft) {
60 return root.leftPadding;
62 if (root.effectiveHorizontalAlignment &
Qt.AlignRight) {
63 return root.width - width - root.rightPadding;
65 return Math.round((root.availableWidth - width) / 2);
68 if (root.alignment &
Qt.AlignTop) {
69 return root.topPadding;
71 if (root.alignment &
Qt.AlignBottom) {
72 return root.height - height - root.bottomPadding;
74 return Math.round((root.availableHeight - height) / 2);
76 width: Math.min(root.availableWidth, implicitWidth)
77 height: Math.min(root.availableHeight, implicitHeight)
81 visible: valid && width > 0 && height > 0 && root.display !== T.AbstractButton.TextOnly
82 implicitWidth:
Kirigami.Units.iconSizes.sizeForLabels
83 implicitHeight:
Kirigami.Units.iconSizes.sizeForLabels
84 Layout.alignment:
Qt.AlignCenter
85 Layout.maximumWidth: implicitWidth > 0 ? implicitWidth :
Number.POSITIVE_INFINITY
86 Layout.maximumHeight: implicitHeight > 0 ? implicitHeight :
Number.POSITIVE_INFINITY
91 visible: text.
length > 0 && root.display !== T.AbstractButton.IconOnly
95 elide: Text.ElideRight
96 Layout.alignment:
Qt.AlignCenter
97 Layout.fillWidth:
true
QString label(StandardShortcut id)
qsizetype length() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:34:35 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.