Commit 5fc25557 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Base text-only face's minimum size on the preferred size of legend

Otherwise we only show two sets of "..." due to eliding both the label
and value of the sensors.

BUG: 434189
FIXED-IN: 5.22
parent 0d610038
......@@ -34,19 +34,16 @@ import org.kde.quickcharts.controls 1.0 as ChartsControls
Faces.SensorFace {
id: root
Layout.minimumWidth: root.formFactor == Faces.SensorFace.Vertical ? Kirigami.Units.gridUnit : Kirigami.Units.gridUnit * 2
contentItem: ColumnLayout {
GroupedText {
totalSensorIds: root.controller.totalSensors
highPrioritySensorIds: root.controller.highPrioritySensorIds
lowPrioritySensorIds: []
showGroups: root.controller.faceConfiguration.groupByTotal
colorSource: root.colorSource
totalHeight: root.height
updateRateLimit: root.controller.updateRateLimit
}
Item { Layout.fillWidth: true; Layout.fillHeight: true }
Layout.minimumWidth: root.formFactor == Faces.SensorFace.Vertical ? Kirigami.Units.gridUnit : contentItem.contentWidth
Layout.minimumHeight: Kirigami.Units.gridUnit
contentItem: GroupedText {
totalSensorIds: root.controller.totalSensors
highPrioritySensorIds: root.controller.highPrioritySensorIds
lowPrioritySensorIds: []
showGroups: root.controller.faceConfiguration.groupByTotal
colorSource: root.colorSource
totalHeight: root.height
updateRateLimit: root.controller.updateRateLimit
}
}
......@@ -37,6 +37,17 @@ ColumnLayout {
property real totalHeight
property int updateRateLimit
readonly property real contentWidth: {
let w = 0
for (let i in children) {
let child = children[i]
if (child.hasOwnProperty("preferredWidth")) {
w = Math.max(w, child.preferredWidth)
}
}
return w
}
Repeater {
model: root.showGroups ? root.totalSensorIds : 1
......@@ -46,6 +57,8 @@ ColumnLayout {
property bool useFullName: true
property var colorSource
readonly property alias preferredWidth: legend.preferredWidth
Kirigami.Heading {
text: groupSensor.formattedValue
level: 3
......
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