From 711789908b0c6c0f76597596d567fba4ae9151ca Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Wed, 29 Jul 2020 13:33:26 -0600 Subject: [PATCH] Drop implicit minimum sizing from PC2 and PC3 Buttons For the following reasons: - It can break and look bad on Plasma Mobile which uses the Plasma style - It makes buttons with icons and short text look visually unbalanced - QStyle and QML desktop style buttons do not do this so it's a source of inconsistency Tests are adjusted to all pass. Stuff looks better to my eye. --- src/declarativeimports/plasmacomponents3/Button.qml | 2 +- src/declarativeimports/plasmastyle/ButtonStyle.qml | 11 ----------- tests/components/button.qml | 2 +- tests/components/button3.qml | 2 +- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/declarativeimports/plasmacomponents3/Button.qml b/src/declarativeimports/plasmacomponents3/Button.qml index ac6fe3d64..71bbf84a9 100644 --- a/src/declarativeimports/plasmacomponents3/Button.qml +++ b/src/declarativeimports/plasmacomponents3/Button.qml @@ -27,7 +27,7 @@ import "private" as Private T.Button { id: control - implicitWidth: Math.max( (label.visible ? units.gridUnit * 6 : units.gridUnit), contentItem.implicitWidth) + implicitWidth: Math.max(units.gridUnit, contentItem.implicitWidth) + leftPadding + rightPadding implicitHeight: Math.max(units.gridUnit, contentItem.implicitHeight) + topPadding + bottomPadding diff --git a/src/declarativeimports/plasmastyle/ButtonStyle.qml b/src/declarativeimports/plasmastyle/ButtonStyle.qml index 3d82c3ec7..6e36b2c11 100644 --- a/src/declarativeimports/plasmastyle/ButtonStyle.qml +++ b/src/declarativeimports/plasmastyle/ButtonStyle.qml @@ -113,17 +113,6 @@ QtQuickControlStyle.ButtonStyle { } background: Item { - - implicitHeight: Math.floor(Math.max(theme.mSize(theme.defaultFont).height*1.6, style.minimumHeight)) - - implicitWidth: { - if (control.text.length == 0) { - height; - } else { - theme.mSize(theme.defaultFont).width*12 - } - } - opacity: enabled ? 1.0 : 0.5 Private.ButtonShadow { diff --git a/tests/components/button.qml b/tests/components/button.qml index dd1b02178..143d852ba 100644 --- a/tests/components/button.qml +++ b/tests/components/button.qml @@ -29,7 +29,7 @@ ComponentBase { } Label { - text: "text alone, should be about 12 chars wide" + text: "text alone, should be about as wide as the text itself" } PlasmaComponents.Button { diff --git a/tests/components/button3.qml b/tests/components/button3.qml index e220432ef..fc04928e6 100644 --- a/tests/components/button3.qml +++ b/tests/components/button3.qml @@ -28,7 +28,7 @@ ComponentBase { } PlasmaComponents.Label { - text: "text alone, should be about 12 chars wide" + text: "text alone, should be about as wide as the text itself" } PlasmaComponents.Button {