Commit 5727362e authored by Michail Vourlakos's avatar Michail Vourlakos Committed by Nate Graham
Browse files

applets/systray: align applet labels with differing line counts in hidden view

Discover current minimum height of applet labels in hidden
view and apply it for all of them when they are shown
inside hidden applets view. This implementation provides
always only the maximum needed label height based on label
contents.

BUG: 438347
FIXED-IN: 5.24.3


(cherry picked from commit 8fcdfc30)
parent 83400745
Pipeline #144960 passed with stage
in 8 minutes and 27 seconds
......@@ -46,6 +46,27 @@ PlasmaComponents3.ScrollView {
readonly property int itemCount: model.count
//! This is used in order to identify the minimum required label height in order for all
//! labels to be aligned properly at all items. At the same time this approach does not
//! enforce labels with 3 lines at all cases so translations that require only one or two
//! lines will always look consistent with no too much padding
readonly property int minLabelHeight: {
var minHeight = 0;
for(let i in contentItem.children){
var gridItem = contentItem.children[i];
if (!gridItem || !gridItem.hasOwnProperty("item") || !gridItem.item.hasOwnProperty("labelHeight")) {
continue;
}
if (gridItem.item.labelHeight > minHeight) {
minHeight = gridItem.item.labelHeight;
}
}
return minHeight;
}
model: PlasmaCore.SortFilterModel {
sourceModel: plasmoid.nativeInterface.systemTrayModel
filterRole: "effectiveStatus"
......
......@@ -21,6 +21,7 @@ PlasmaCore.ToolTipArea {
property string itemId
property alias text: label.text
property alias labelHeight: label.implicitHeight
property alias iconContainer: iconContainer
property int /*PlasmaCore.Types.ItemStatus*/ status: model.status || PlasmaCore.Types.UnknownStatus
property int /*PlasmaCore.Types.ItemStatus*/ effectiveStatus: model.effectiveStatus || PlasmaCore.Types.UnknownStatus
......@@ -140,6 +141,11 @@ PlasmaCore.ToolTipArea {
Layout.fillWidth: true
Layout.fillHeight: abstractItem.inHiddenLayout ? true : false
//! Minimum required height for all labels is used in order for all
//! labels to be aligned properly at all items. At the same time this approach does not
//! enforce labels with 3 lines at all cases so translations that require only one or two
//! lines will always look consistent with no too much padding
Layout.minimumHeight: abstractItem.inHiddenLayout ? hiddenTasks.minLabelHeight : 0
Layout.leftMargin: abstractItem.inHiddenLayout ? PlasmaCore.Units.smallSpacing : 0
Layout.rightMargin: abstractItem.inHiddenLayout ? PlasmaCore.Units.smallSpacing : 0
Layout.bottomMargin: abstractItem.inHiddenLayout ? PlasmaCore.Units.smallSpacing : 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