Fix Button minimumWidth property

Plasma's Button has an extra property "minimumWidth" which is an extra
hint not in QQC to say "what is the size to exactly fit the contents".

(it's a bit confusing, as we can perfectly handle a button below it's
"minmimum" size)

This should be based on the size the contents want to be (the
implicitWidth), not how small the contents can go (which with is pretty
meaningless when our button can elide)

It got broken at some point recently.

BUG: 353584
Change-Id: I637898c3abf98183bbae30d8f15c4d72801a3650
REVIEW: 125698
This commit is contained in:
David Edmundson 2015-10-18 23:52:00 +01:00
parent e6ba526539
commit 1a4c1d7eeb
2 changed files with 15 additions and 3 deletions

View File

@ -32,13 +32,14 @@ import "private" as Private
QtQuickControlStyle.ButtonStyle {
id: style
//this is the minimum size that can hold the entire contents
property int minimumWidth
property int minimumHeight
label: RowLayout {
spacing: units.smallSpacing
property real minimumWidth: Layout.minimumWidth + style.padding.left + style.padding.right
property real minimumWidth: implicitWidth + style.padding.left + style.padding.right
onMinimumWidthChanged: {
if (control.minimumWidth !== undefined) {
style.minimumWidth = minimumWidth;
@ -46,7 +47,7 @@ QtQuickControlStyle.ButtonStyle {
}
}
property real minimumHeight: Layout.preferredHeight + style.padding.top + style.padding.bottom
property real minimumHeight: implicitHeight + style.padding.top + style.padding.bottom
onMinimumHeightChanged: {
if (control.minimumHeight !== undefined) {
style.minimumHeight = minimumHeight;

View File

@ -7,7 +7,7 @@ import QtQuick.Layouts 1.2
Rectangle
{
width: 500
height: 300
height: 500
color: "white"
Grid {
@ -107,6 +107,17 @@ Rectangle
}
}
Label {
text: "minimum width property. Should be two letters wide"
}
RowLayout {
PlasmaComponents.Button {
text: "AA"
implicitWidth: minimumWidth
}
}
}
}