Fix loop on ButtonStyle
Nowadays the size of the icon is defined by the size of the button itself, and vice-versa. This patch uses the unit sizes to decide which sizes to offer. REVIEW: 124628
This commit is contained in:
parent
4e9f3dd129
commit
f87f03b4a8
@ -38,7 +38,7 @@ QtQuickControlStyle.ButtonStyle {
|
|||||||
label: RowLayout {
|
label: RowLayout {
|
||||||
id: buttonContent
|
id: buttonContent
|
||||||
spacing: units.smallSpacing
|
spacing: units.smallSpacing
|
||||||
Layout.preferredHeight: Math.max(units.iconSizes.small, label.implicitHeight)
|
Layout.preferredHeight: Math.max(units.iconSizes.small, label.implicitHeight, icon.implicitHeight)
|
||||||
|
|
||||||
property real minimumWidth: Layout.minimumWidth + style.padding.left + style.padding.right
|
property real minimumWidth: Layout.minimumWidth + style.padding.left + style.padding.right
|
||||||
onMinimumWidthChanged: {
|
onMinimumWidthChanged: {
|
||||||
@ -60,11 +60,11 @@ QtQuickControlStyle.ButtonStyle {
|
|||||||
id: icon
|
id: icon
|
||||||
source: control.iconName || control.iconSource
|
source: control.iconName || control.iconSource
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
Layout.minimumWidth: valid ? parent.height: 0
|
Layout.minimumWidth: valid ? units.iconSizes.tiny : 0
|
||||||
Layout.maximumWidth: Layout.minimumWidth
|
Layout.preferredWidth: valid ? units.iconSizes.small : 0
|
||||||
visible: valid
|
visible: valid
|
||||||
Layout.minimumHeight: Layout.minimumWidth
|
Layout.minimumHeight: Layout.minimumWidth
|
||||||
Layout.maximumHeight: Layout.minimumWidth
|
Layout.preferredHeight: Layout.preferredWidth
|
||||||
active: control.hovered
|
active: control.hovered
|
||||||
colorGroup: PlasmaCore.Theme.ButtonColorGroup
|
colorGroup: PlasmaCore.Theme.ButtonColorGroup
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user