diff --git a/src/declarativeimports/plasmacomponents/qml/Button.qml b/src/declarativeimports/plasmacomponents/qml/Button.qml index 5a15b65f0..cc430d292 100644 --- a/src/declarativeimports/plasmacomponents/qml/Button.qml +++ b/src/declarativeimports/plasmacomponents/qml/Button.qml @@ -56,12 +56,12 @@ QtControls.Button { /** * Smallest width this button can be to show all the contents */ - property real minimumWidth: icon.width + style.label.implicitWidth + surfaceNormal.margins.left + surfaceNormal.margins.right + ((icon.valid) ? surfaceNormal.margins.left : 0) + property real minimumWidth: 0//__style.minimumWidth /** * Smallest height this button can be to show all the contents */ - property real minimumHeight: Math.max(units.iconSizes.small, style.label.implicitHeight) + surfaceNormal.margins.top + surfaceNormal.margins.bottom + property real minimumHeight: 0//__style.minimumHeight style: Styles.ButtonStyle {} } diff --git a/src/declarativeimports/plasmacomponents/qml/styles/ButtonStyle.qml b/src/declarativeimports/plasmacomponents/qml/styles/ButtonStyle.qml index 934b000a0..d6bf144aa 100644 --- a/src/declarativeimports/plasmacomponents/qml/styles/ButtonStyle.qml +++ b/src/declarativeimports/plasmacomponents/qml/styles/ButtonStyle.qml @@ -33,6 +33,20 @@ QtQuickControlStyle.ButtonStyle { id: buttonContent spacing: icon.valid ? units.smallSpacing : 0 + property real minimumWidth: icon.width + label.implicitWidth + style.padding.left + style.padding.right + ((icon.valid) ? style.padding.left : 0) + onMinimumWidthChanged: { + if (control.minimumWidth !== undefined) { + control.minimumWidth = minimumWidth; + } + } + + property real minimumHeight: Math.max(units.iconSizes.small, label.implicitHeight) + style.padding.top + style.padding.bottom + onMinimumHeightChanged: { + if (control.minimumHeight !== undefined) { + control.minimumHeight = minimumHeight + } + } + PlasmaCore.IconItem { id: icon source: control.iconSource @@ -40,7 +54,7 @@ QtQuickControlStyle.ButtonStyle { width: valid ? parent.height: 0 visible: valid height: width - active: shadow.hasOverState && mouse.containsMouse + active: control.hovered colorGroup: PlasmaCore.Theme.ButtonColorGroup } @@ -54,12 +68,13 @@ QtQuickControlStyle.ButtonStyle { horizontalAlignment: icon.valid ? Text.AlignLeft : Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight + onImplicitHeightChanged: style.labelImplicitHeight = implicitHeight + onImplicitWidthChanged: style.labelImplicitWidth = implicitWidth } } background: Item { - implicitHeight: Math.floor(Math.max(theme.mSize(theme.defaultFont).height*1.6, control.minimumHeight)) implicitWidth: { @@ -133,8 +148,8 @@ QtQuickControlStyle.ButtonStyle { //TODO: create on demand? PlasmaCore.SvgItem { visible: control.menu !== null - width: drowDownButtonWidth - height: drowDownButtonWidth + width: units.iconSizes.small + height: width anchors { right: parent.right rightMargin: surfaceNormal.margins.right @@ -143,5 +158,11 @@ QtQuickControlStyle.ButtonStyle { svg: PlasmaCore.Svg { imagePath: "widgets/arrows" } elementId: "down-arrow" } + Component.onCompleted: { + padding.top = surfaceNormal.margins.top + padding.left = surfaceNormal.margins.left + padding.right = surfaceNormal.margins.right + padding.bottom = surfaceNormal.margins.bottom + } } }