Buttons: allow to scale up icons

Summary:
always scale icons unless a size is specified in the api.
this makes icon sizing more in line with plasma components 2

Test Plan:
{F8129062}

{F8129064}

{F8129065}

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: broulik, ngraham, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27628
This commit is contained in:
Marco Martin 2020-02-24 17:32:35 +01:00
parent b7fa6e0e91
commit 0b89e7f3f0
4 changed files with 64 additions and 24 deletions

View File

@ -54,16 +54,17 @@ T.Button {
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: control.display === T.Button.TextUnderIcon
Layout.fillHeight: control.display !== T.Button.TextUnderIcon
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: units.iconSizes.tiny
Layout.minimumHeight: units.iconSizes.tiny
Layout.maximumWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.small
Layout.maximumHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.small
Layout.minimumWidth: Math.min(parent.width, parent.height, implicitWidth)
Layout.minimumHeight: Math.min(parent.width, parent.height, implicitHeight)
implicitWidth: Layout.maximumWidth
implicitHeight: Layout.maximumHeight
Layout.maximumWidth: control.icon.width > 0 ? control.icon.width : Number.POSITIVE_INFINITY
Layout.maximumHeight: control.icon.height > 0 ? control.icon.height : Number.POSITIVE_INFINITY
implicitWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.small
implicitHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.small
colorGroup: PlasmaCore.Theme.ButtonColorGroup
visible: source.length > 0 && control.display !== T.Button.TextOnly

View File

@ -47,16 +47,17 @@ T.TabButton {
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: control.display === T.AbstractButton.TextUnderIcon
Layout.fillHeight: control.display !== T.AbstractButton.TextUnderIcon
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: units.iconSizes.tiny
Layout.minimumHeight: units.iconSizes.tiny
Layout.maximumWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.smallMedium
Layout.maximumHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.smallMedium
Layout.minimumWidth: Math.min(parent.width, parent.height, implicitWidth)
Layout.minimumHeight: Math.min(parent.width, parent.height, implicitHeight)
implicitWidth: Layout.maximumWidth
implicitHeight: Layout.maximumHeight
Layout.maximumWidth: control.icon.width > 0 ? control.icon.width : Number.POSITIVE_INFINITY
Layout.maximumHeight: control.icon.height > 0 ? control.icon.height : Number.POSITIVE_INFINITY
implicitWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.smallMedium
implicitHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.smallMedium
colorGroup: control.PlasmaCore.ColorScope.colorGroup
visible: source.length > 0 && control.display !== T.AbstractButton.TextOnly

View File

@ -56,16 +56,17 @@ T.ToolButton {
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: control.display === T.AbstractButton.TextUnderIcon
Layout.fillHeight: control.display !== T.AbstractButton.TextUnderIcon
Layout.fillWidth: true
Layout.fillHeight: true
Layout.minimumWidth: units.iconSizes.tiny
Layout.minimumHeight: units.iconSizes.tiny
Layout.maximumWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.smallMedium
Layout.maximumHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.smallMedium
Layout.minimumWidth: Math.min(parent.width, parent.height, implicitWidth)
Layout.minimumHeight: Math.min(parent.width, parent.height, implicitHeight)
implicitWidth: Layout.maximumWidth
implicitHeight: Layout.maximumHeight
Layout.maximumWidth: control.icon.width > 0 ? control.icon.width : Number.POSITIVE_INFINITY
Layout.maximumHeight: control.icon.height > 0 ? control.icon.height : Number.POSITIVE_INFINITY
implicitWidth: control.icon.width > 0 ? control.icon.width : units.iconSizes.smallMedium
implicitHeight: control.icon.height > 0 ? control.icon.height : units.iconSizes.smallMedium
colorGroup: control.PlasmaCore.ColorScope.colorGroup
visible: source.length > 0 && control.display !== T.AbstractButton.TextOnly

View File

@ -80,6 +80,43 @@ ComponentBase {
icon.name: "list-remove"
}
}
PlasmaComponents.Label {
text: "Fixed size and stretching size buttons"
}
GridLayout {
id: layout
rows: 2
columns:2
Layout.fillWidth: true
Layout.fillHeight: true
PlasmaComponents.ToolButton {
id: closeButton
icon.name: "window-close"
text: "Text"
}
PlasmaComponents.ToolButton {
id: closeButton2
icon.name: "window-close"
Layout.fillWidth: true
Layout.fillHeight: true
icon.width: units.iconSizes.small
icon.height: units.iconSizes.small
text: "Text"
}
PlasmaComponents.ToolButton {
id: closeButton3
icon.name: "window-close"
Layout.fillHeight: true
text: "Text"
}
PlasmaComponents.ToolButton {
id: closeButton4
icon.name: "window-close"
Layout.fillWidth: true
Layout.fillHeight: true
text: "Text"
}
}
}
}