Changeset View
Changeset View
Standalone View
Standalone View
faces/import/ExtendedLegend.qml
- This file was moved from sensors/declarative/ExtendedLegend.qml.
Show All 28 Lines | |||||
29 | import org.kde.ksysguard.sensors 1.0 | 29 | import org.kde.ksysguard.sensors 1.0 | ||
30 | 30 | | |||
31 | import org.kde.quickcharts 1.0 as Charts | 31 | import org.kde.quickcharts 1.0 as Charts | ||
32 | import org.kde.quickcharts.controls 1.0 as ChartsControls | 32 | import org.kde.quickcharts.controls 1.0 as ChartsControls | ||
33 | 33 | | |||
34 | ChartsControls.Legend { | 34 | ChartsControls.Legend { | ||
35 | id: legend | 35 | id: legend | ||
36 | 36 | | |||
37 | property alias textOnlySensorIds: textOnlySensorsRepeater.model | 37 | property alias sensorIds: sensorsRepeater.model | ||
38 | property var sourceModel | 38 | property var sourceModel | ||
39 | property var colorSource | 39 | property var colorSource | ||
40 | 40 | | |||
41 | flow: GridLayout.TopToBottom | 41 | flow: GridLayout.TopToBottom | ||
42 | 42 | | |||
43 | Layout.maximumHeight: implicitHeight | 43 | Layout.maximumHeight: implicitHeight | ||
44 | Layout.maximumWidth: parent.width | 44 | Layout.maximumWidth: parent.width | ||
45 | 45 | | |||
46 | spacing: Kirigami.Units.smallSpacing | 46 | spacing: Kirigami.Units.smallSpacing | ||
47 | 47 | | |||
48 | valueVisible: true | 48 | valueVisible: true | ||
49 | valueWidth: units.gridUnit * 2 | 49 | valueWidth: units.gridUnit * 2 | ||
50 | formatValue: function(input, index) { | 50 | formatValue: function(input, index) { | ||
51 | return Formatter.formatValueShowNull(input, sourceModel.data(sourceModel.index(0, index), SensorDataModel.Unit)) | 51 | return Formatter.formatValueShowNull(input, sourceModel.data(sourceModel.index(0, index), SensorDataModel.Unit)) | ||
52 | } | 52 | } | ||
53 | 53 | | |||
54 | Repeater { | 54 | Repeater { | ||
55 | id: textOnlySensorsRepeater | 55 | id: sensorsRepeater | ||
56 | delegate: ChartsControls.LegendDelegate { | 56 | delegate: ChartsControls.LegendDelegate { | ||
57 | name: sensor.shortName | 57 | name: sensor.shortName | ||
58 | value: sensor.formattedValue || "" | 58 | value: sensor.formattedValue || "" | ||
59 | colorVisible: false | 59 | colorVisible: false | ||
60 | 60 | | |||
61 | layoutWidth: legend.width | 61 | layoutWidth: legend.width | ||
62 | valueWidth: units.gridUnit * 2 | 62 | valueWidth: units.gridUnit * 2 | ||
63 | 63 | | |||
64 | Sensor { | 64 | Sensor { | ||
65 | id: sensor | 65 | id: sensor | ||
66 | sensorId: modelData | 66 | sensorId: modelData | ||
67 | } | 67 | } | ||
68 | } | 68 | } | ||
69 | } | 69 | } | ||
70 | } | 70 | } |