From ad625f68f345f56da65a04d79499cd3fd0d26979 Mon Sep 17 00:00:00 2001 From: Noah Davis Date: Sat, 18 Jan 2020 21:40:36 -0500 Subject: [PATCH] Fix the size and pixel alignment of checkboxes and radiobuttons Summary: The checkboxes and radio buttons in plasmashell were signficantly different from checkboxes and radio buttons in the Breeze QStyle. This patch is needed to make D26271 look nicer. - Plasmashell checkboxes and radio buttons were much larger. -- 24x24 for checkboxes and 29x29 for radio buttons (Plasmashell) vs 16x16 (QStyle). - Pixel alignment was very poor. -- Checkbox indicator was 14x14, stretched to 24x24. -- Radio button background was 22x22 or 32x32, adjusted to 29x29. -- Radio button indicator was 16x16, stretched to 29x29. - Style was different. -- Checkbox indicators had sharper corners and less margin around the inner rectangle. -- Radio buttons had a hardcoded dark gray circular frame and a shadow on the bottom of the inside of the frame. -- Radio button indicators had less margin around the inner circle. Test Plan: {F7891476} {F7891477} Reviewers: #plasma, #vdg, ngraham Reviewed By: #vdg, ngraham Subscribers: ngraham, davidedmundson, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D26758 --- .../plasmacomponents3/CheckIndicator.qml | 4 +- .../plasmacomponents3/RadioButton.qml | 4 +- .../plasmacomponents3/RadioIndicator.qml | 2 +- .../plasmastyle/CheckBoxStyle.qml | 4 +- .../plasmastyle/RadioButtonStyle.qml | 4 +- .../breeze/widgets/actionbutton.svg | 632 +++--------------- .../breeze/widgets/checkmarks.svg | 252 ++----- 7 files changed, 143 insertions(+), 759 deletions(-) diff --git a/src/declarativeimports/plasmacomponents3/CheckIndicator.qml b/src/declarativeimports/plasmacomponents3/CheckIndicator.qml index 42a6784ef..8710ec044 100644 --- a/src/declarativeimports/plasmacomponents3/CheckIndicator.qml +++ b/src/declarativeimports/plasmacomponents3/CheckIndicator.qml @@ -26,8 +26,8 @@ PlasmaCore.FrameSvgItem { property Item control imagePath: "widgets/button" prefix: "normal" - implicitWidth: units.gridUnit - implicitHeight: units.gridUnit + implicitWidth: units.iconSizes.small + implicitHeight: implicitWidth opacity: control.enabled ? 1 : 0.6 PlasmaCore.SvgItem { diff --git a/src/declarativeimports/plasmacomponents3/RadioButton.qml b/src/declarativeimports/plasmacomponents3/RadioButton.qml index bf495688b..955e7bf6a 100644 --- a/src/declarativeimports/plasmacomponents3/RadioButton.qml +++ b/src/declarativeimports/plasmacomponents3/RadioButton.qml @@ -27,7 +27,9 @@ T.RadioButton { implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) - implicitHeight: units.gridUnit * 1.6 + implicitHeight: Math.max(background ? background.implicitHeight : 0, + Math.max(contentItem.implicitHeight, + indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset padding: 1 diff --git a/src/declarativeimports/plasmacomponents3/RadioIndicator.qml b/src/declarativeimports/plasmacomponents3/RadioIndicator.qml index 61b47cb5a..79697168d 100644 --- a/src/declarativeimports/plasmacomponents3/RadioIndicator.qml +++ b/src/declarativeimports/plasmacomponents3/RadioIndicator.qml @@ -31,7 +31,7 @@ PlasmaCore.SvgItem { opacity: control.enabled ? 1 : 0.6 implicitWidth: implicitHeight - implicitHeight: units.gridUnit + implicitHeight: units.iconSizes.small PlasmaCore.SvgItem { id: checkmark diff --git a/src/declarativeimports/plasmastyle/CheckBoxStyle.qml b/src/declarativeimports/plasmastyle/CheckBoxStyle.qml index dc8aa20f1..7d4373bfa 100644 --- a/src/declarativeimports/plasmastyle/CheckBoxStyle.qml +++ b/src/declarativeimports/plasmastyle/CheckBoxStyle.qml @@ -45,8 +45,8 @@ QtQuickControlStyle.CheckBoxStyle { indicator: PlasmaCore.FrameSvgItem { imagePath: "widgets/button" prefix: "normal" - width: theme.mSize(theme.defaultFont).height + margins.left - height: theme.mSize(theme.defaultFont).height + margins.top + width: units.iconSizes.small + height: width opacity: control.enabled ? 1 : 0.6 PlasmaCore.SvgItem { diff --git a/src/declarativeimports/plasmastyle/RadioButtonStyle.qml b/src/declarativeimports/plasmastyle/RadioButtonStyle.qml index 0468c4c14..a225c4161 100644 --- a/src/declarativeimports/plasmastyle/RadioButtonStyle.qml +++ b/src/declarativeimports/plasmastyle/RadioButtonStyle.qml @@ -51,8 +51,8 @@ QtQuickControlStyle.RadioButtonStyle { elementId: "normal" opacity: control.enabled ? 1 : 0.6 - width: height - height: theme.mSize(theme.defaultFont).height * 1.6 + width: units.iconSizes.small + height: width PlasmaCore.SvgItem { id: checkmark diff --git a/src/desktoptheme/breeze/widgets/actionbutton.svg b/src/desktoptheme/breeze/widgets/actionbutton.svg index 11f8e11f1..04f98d801 100644 --- a/src/desktoptheme/breeze/widgets/actionbutton.svg +++ b/src/desktoptheme/breeze/widgets/actionbutton.svg @@ -1,556 +1,94 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - + + + + + + - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - + + + + - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/src/desktoptheme/breeze/widgets/checkmarks.svg b/src/desktoptheme/breeze/widgets/checkmarks.svg index c62b6296b..f97028e0f 100644 --- a/src/desktoptheme/breeze/widgets/checkmarks.svg +++ b/src/desktoptheme/breeze/widgets/checkmarks.svg @@ -1,207 +1,51 @@ - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - + + + + + + - - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +