From b3ee36cfbb8d31a8be47daf8c1227b790bbd2472 Mon Sep 17 00:00:00 2001 From: Noah Davis Date: Fri, 16 Oct 2020 02:31:09 -0400 Subject: [PATCH] Add margin hints to toolbar.svg and refactor PC3 ToolBar There's no need to redefine contentWidth and contentHeight. For controls based on QQC2 Pane, content size is implicit size if not 0, else the implicit size of the top level child item if there is only one. --- .../plasmacomponents3/ToolBar.qml | 15 +++-- src/desktoptheme/breeze/widgets/toolbar.svg | 65 ++++++++++--------- 2 files changed, 43 insertions(+), 37 deletions(-) diff --git a/src/declarativeimports/plasmacomponents3/ToolBar.qml b/src/declarativeimports/plasmacomponents3/ToolBar.qml index 642088f11..dee41c9cb 100644 --- a/src/declarativeimports/plasmacomponents3/ToolBar.qml +++ b/src/declarativeimports/plasmacomponents3/ToolBar.qml @@ -11,17 +11,20 @@ import org.kde.plasma.core 2.0 as PlasmaCore T.ToolBar { id: control - implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) - implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + implicitContentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + implicitContentHeight + topPadding + bottomPadding) - contentWidth: contentChildren[0].implicitWidth - contentHeight: contentChildren[0].implicitHeight + leftPadding: background.leftMargin + topPadding: background.topMargin + rightPadding: background.rightMargin + bottomPadding: background.bottomMargin - padding: units.smallSpacing contentItem: Item { } background: PlasmaCore.FrameSvgItem { - implicitHeight: 40 + implicitHeight: 40 // TODO: Find a good way to sync this with the size of (Button or ToolButton) + padding imagePath: "widgets/toolbar" colorGroup: PlasmaCore.ColorScope.colorGroup enabledBorders: control.position == T.ToolBar.Header ? PlasmaCore.FrameSvgItem.BottomBorder : PlasmaCore.FrameSvgItem.TopBorder diff --git a/src/desktoptheme/breeze/widgets/toolbar.svg b/src/desktoptheme/breeze/widgets/toolbar.svg index f8f32a167..1d355b709 100644 --- a/src/desktoptheme/breeze/widgets/toolbar.svg +++ b/src/desktoptheme/breeze/widgets/toolbar.svg @@ -1,23 +1,22 @@ - - - - - - - - - - image/svg+xml - - - - image/svg+xml - - - - - - + + + + + + + + + + + + + +