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:
parent
e6ba526539
commit
1a4c1d7eeb
@ -32,13 +32,14 @@ import "private" as Private
|
|||||||
QtQuickControlStyle.ButtonStyle {
|
QtQuickControlStyle.ButtonStyle {
|
||||||
id: style
|
id: style
|
||||||
|
|
||||||
|
//this is the minimum size that can hold the entire contents
|
||||||
property int minimumWidth
|
property int minimumWidth
|
||||||
property int minimumHeight
|
property int minimumHeight
|
||||||
|
|
||||||
label: RowLayout {
|
label: RowLayout {
|
||||||
spacing: units.smallSpacing
|
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: {
|
onMinimumWidthChanged: {
|
||||||
if (control.minimumWidth !== undefined) {
|
if (control.minimumWidth !== undefined) {
|
||||||
style.minimumWidth = minimumWidth;
|
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: {
|
onMinimumHeightChanged: {
|
||||||
if (control.minimumHeight !== undefined) {
|
if (control.minimumHeight !== undefined) {
|
||||||
style.minimumHeight = minimumHeight;
|
style.minimumHeight = minimumHeight;
|
||||||
|
@ -7,7 +7,7 @@ import QtQuick.Layouts 1.2
|
|||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
width: 500
|
width: 500
|
||||||
height: 300
|
height: 500
|
||||||
color: "white"
|
color: "white"
|
||||||
|
|
||||||
Grid {
|
Grid {
|
||||||
@ -107,6 +107,17 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: "minimum width property. Should be two letters wide"
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
PlasmaComponents.Button {
|
||||||
|
text: "AA"
|
||||||
|
implicitWidth: minimumWidth
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user