Verified Commit 345a8e1c authored by Fushan Wen's avatar Fushan Wen
Browse files

applets/kickoff: remove excessive spacing when icon and label are set

Use contentWidth to avoid binding loops, and set spacing to follow
RowLayout's.

(cherry picked from commit 8687f24a)
parent 0820ce6b
Pipeline #233627 passed with stage
in 4 minutes and 8 seconds
......@@ -164,13 +164,13 @@ Item {
Layout.minimumWidth: {
if (!kickoff.inPanel) {
return Tools.dynamicSetWidgetWidth(plasmoid.icon, buttonIcon.width, kickoff.menuLabel, labelTextField.width, PlasmaCore.Units.smallSpacing * 2);
return Tools.dynamicSetWidgetWidth(plasmoid.icon, buttonIcon.width, kickoff.menuLabel, labelTextField.contentWidth, iconLabelRow.spacing);
}
if (kickoff.vertical) {
return -1;
} else {
return Tools.dynamicSetWidgetWidth(plasmoid.icon, buttonIcon.width, kickoff.menuLabel, labelTextField.width, PlasmaCore.Units.smallSpacing * 2);
return Tools.dynamicSetWidgetWidth(plasmoid.icon, buttonIcon.width, kickoff.menuLabel, labelTextField.contentWidth, iconLabelRow.spacing);
}
}
......@@ -194,7 +194,7 @@ Item {
if (kickoff.vertical) {
return PlasmaCore.Units.iconSizeHints.panel;
} else {
return Tools.dynamicSetWidgetWidth(plasmoid.icon, buttonIcon.width, kickoff.menuLabel, labelTextField.width, PlasmaCore.Units.smallSpacing * 2);
return Tools.dynamicSetWidgetWidth(plasmoid.icon, buttonIcon.width, kickoff.menuLabel, labelTextField.contentWidth, iconLabelRow.spacing);
}
}
......@@ -230,6 +230,7 @@ Item {
}
RowLayout {
id: iconLabelRow
anchors.fill: parent
spacing: PlasmaCore.Units.smallSpacing
......
......@@ -185,7 +185,6 @@ function dynamicSetWidgetWidth(icon, buttonIconWidth, kickoffMenuLabel, menuLabe
return [
returnValueIfExists(icon, buttonIconWidth),
returnValueIfExists(kickoffMenuLabel, menuLabelWidth),
returnValueIfExists(kickoffMenuLabel, spacing),
returnValueIfExists(kickoffMenuLabel && icon, spacing)
].reduce((sum, n) => sum + n, 0);
}
Supports Markdown
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