Commit 3a133b70 authored by Marco Martin's avatar Marco Martin

expose better size hints

expose size hints calculated better that make sure that when in popup
the full legend is shown

BUG:422669
BUG:422888
parent ca980e72
......@@ -34,8 +34,10 @@ import org.kde.quickcharts.controls 1.0 as ChartControls
Faces.SensorFace {
id: root
Layout.minimumWidth: formFactor == Faces.SensorFace.Horizontal ? Kirigami.Units.gridUnit / 2 * barChart.barCount : 1
contentItem: ColumnLayout {
BarChart {
id: barChart
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignCenter
......
......@@ -36,16 +36,23 @@ Faces.SensorFace {
readonly property bool showLegend: controller.faceConfiguration.showLegend
// Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
Layout.minimumWidth: Kirigami.Units.gridUnit * 8
Layout.minimumWidth: Math.max(Kirigami.Units.gridUnit * compactRepresentation.barCount, Kirigami.Units.gridUnit * 8)
Layout.preferredWidth: titleMetrics.width + leftPadding + rightPadding
contentItem: ColumnLayout {
Kirigami.Heading {
id: heading
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
text: root.controller.title
visible: text.length > 0
level: 2
TextMetrics {
id: titleMetrics
font: heading.font
text: heading.text
}
}
BarChart {
......@@ -61,6 +68,7 @@ Faces.SensorFace {
Layout.fillWidth: root.width < implicitWidth * 1.5
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.fillHeight: true
Layout.minimumHeight: root.formFactor !== Faces.SensorFace.Planar ? implicitHeight : -1
visible: root.showLegend
chart: compactRepresentation
sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
......
......@@ -34,6 +34,7 @@ Faces.SensorFace {
readonly property bool showLegend: controller.faceConfiguration.showLegend
// Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
Layout.minimumWidth: Kirigami.Units.gridUnit * 8
Layout.preferredWidth: titleMetrics.width + leftPadding + rightPadding
contentItem: ColumnLayout {
Kirigami.Heading {
......@@ -43,6 +44,11 @@ Faces.SensorFace {
text: root.controller.title
visible: text.length > 0
level: 2
TextMetrics {
id: titleMetrics
font: heading.font
text: heading.text
}
}
LineChart {
......@@ -57,6 +63,7 @@ Faces.SensorFace {
Layout.fillWidth: root.width < implicitWidth * 1.5
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.fillHeight: true
Layout.minimumHeight: root.formFactor !== Faces.SensorFace.Planar ? implicitHeight : -1
visible: root.showLegend
chart: compactRepresentation
sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
......
......@@ -35,11 +35,10 @@ Faces.SensorFace {
id: root
readonly property bool showLegend: controller.faceConfiguration.showLegend
contentItem: ColumnLayout {
// Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
Layout.minimumWidth: Kirigami.Units.gridUnit * 8
Layout.preferredWidth: Kirigami.Units.gridUnit * 8
Layout.minimumWidth: Kirigami.Units.gridUnit * 8
Layout.preferredWidth: titleMetrics.width + leftPadding + rightPadding
contentItem: ColumnLayout {
spacing: Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing
Kirigami.Heading {
Layout.fillWidth: true
......@@ -48,6 +47,11 @@ Faces.SensorFace {
text: root.controller.title
visible: text.length > 0
level: 2
TextMetrics {
id: titleMetrics
font: heading.font
text: heading.text
}
}
PieChart {
......@@ -63,6 +67,7 @@ Faces.SensorFace {
Layout.fillWidth: root.width < implicitWidth * 1.5
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.fillHeight: true
Layout.minimumHeight: root.formFactor !== Faces.SensorFace.Planar ? implicitHeight : -1
visible: root.showLegend
chart: compactRepresentation.chart
sourceModel: root.showLegend ? compactRepresentation.sensorsModel : null
......
......@@ -35,6 +35,7 @@ Faces.SensorFace {
// Arbitrary minimumWidth to make easier to align plasmoids in a predictable way
Layout.minimumWidth: Kirigami.Units.gridUnit * 8
Layout.preferredWidth: titleMetrics.width + leftPadding + rightPadding
contentItem: ColumnLayout {
......@@ -45,6 +46,11 @@ Faces.SensorFace {
text: root.controller.title
visible: text.length > 0
level: 2
TextMetrics {
id: titleMetrics
font: heading.font
text: heading.text
}
}
Item { Layout.fillWidth: true; Layout.fillHeight: true }
......
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