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.
This commit is contained in:
Nate Graham 2020-07-29 13:33:26 -06:00
parent 458ba419f3
commit 711789908b
4 changed files with 3 additions and 14 deletions

View File

@ -27,7 +27,7 @@ import "private" as Private
T.Button { T.Button {
id: control id: control
implicitWidth: Math.max( (label.visible ? units.gridUnit * 6 : units.gridUnit), contentItem.implicitWidth) implicitWidth: Math.max(units.gridUnit, contentItem.implicitWidth)
+ leftPadding + rightPadding + leftPadding + rightPadding
implicitHeight: Math.max(units.gridUnit, contentItem.implicitHeight) implicitHeight: Math.max(units.gridUnit, contentItem.implicitHeight)
+ topPadding + bottomPadding + topPadding + bottomPadding

View File

@ -113,17 +113,6 @@ QtQuickControlStyle.ButtonStyle {
} }
background: Item { 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 opacity: enabled ? 1.0 : 0.5
Private.ButtonShadow { Private.ButtonShadow {

View File

@ -29,7 +29,7 @@ ComponentBase {
} }
Label { Label {
text: "text alone, should be about 12 chars wide" text: "text alone, should be about as wide as the text itself"
} }
PlasmaComponents.Button { PlasmaComponents.Button {

View File

@ -28,7 +28,7 @@ ComponentBase {
} }
PlasmaComponents.Label { 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 { PlasmaComponents.Button {