Commit 2a9699b0 authored by Devin Lin's avatar Devin Lin 🎨
Browse files

panel: Fix quicksetting delegate width not getting enforced on label

parent f2cf20b6
......@@ -27,12 +27,15 @@ ColumnLayout {
required property var toggleFunction
property alias labelOpacity: label.opacity
required property real boundingWidth
property color disabledButtonColor: PlasmaCore.Theme.backgroundColor
property color disabledPressedButtonColor: Qt.darker(disabledButtonColor, 1.1)
property color enabledButtonColor: Kirigami.ColorUtils.adjustColor(PlasmaCore.ColorScope.highlightColor, {"alpha": 0.4*255})
property color enabledPressedButtonColor: Kirigami.ColorUtils.adjustColor(PlasmaCore.ColorScope.highlightColor, {"alpha": 0.6*255});
Rectangle {
id: iconButton
Layout.preferredWidth: PlasmaCore.Units.iconSizes.large + PlasmaCore.Units.smallSpacing
Layout.minimumHeight: width
Layout.alignment: Qt.AlignHCenter
......@@ -95,7 +98,7 @@ ColumnLayout {
PlasmaComponents.Label {
id: label
Layout.maximumWidth: parent.width
Layout.maximumWidth: delegateRoot.boundingWidth - arrow.width - PlasmaCore.Units.smallSpacing * 2
Layout.alignment: Qt.AlignHCenter
text: delegateRoot.text
......@@ -106,6 +109,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter
PlasmaCore.SvgItem {
id: arrow
anchors {
left: parent.right
verticalCenter: parent.verticalCenter
......
......@@ -136,10 +136,10 @@ Item {
delegate: Delegate {
id: delegateItem
required property var modelData
width: root.expandedRatio < 0.4
? Math.max(implicitWidth + PlasmaCore.Units.smallSpacing * 2, flow.width / (flow.columns + 1))
: Math.max(implicitWidth + PlasmaCore.Units.smallSpacing * 2,
(flow.width / (flow.columns + 1)) * (1 - root.expandedRatio) + (flow.width / flow.columns) * root.expandedRatio)
width: Math.max(implicitWidth + PlasmaCore.Units.smallSpacing * 2, boundingWidth)
boundingWidth: root.expandedRatio < 0.4
? flow.width / (flow.columns + 1)
: (flow.width / (flow.columns + 1)) * (1 - root.expandedRatio) + (flow.width / flow.columns) * root.expandedRatio
labelOpacity: y > 0 ? 1 : root.expandedRatio
opacity: y <= 0 ? 1 : root.expandedRatio
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment