Changeset View
Changeset View
Standalone View
Standalone View
faces/facepackages/linechart/contents/ui/CompactRepresentation.qml
- This file was copied from sensors/declarative/ExtendedLegend.qml.
Show All 15 Lines | |||||
16 | * | 16 | * | ||
17 | * You should have received a copy of the GNU Library General Public | 17 | * You should have received a copy of the GNU Library General Public | ||
18 | * License along with this program; if not, write to the | 18 | * License along with this program; if not, write to the | ||
19 | * Free Software Foundation, Inc., | 19 | * Free Software Foundation, Inc., | ||
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | import QtQuick 2.9 | 23 | import QtQuick 2.9 | ||
24 | import QtQuick.Controls 2.2 as QQC2 | ||||
ngraham: `as QQC2` | |||||
24 | import QtQuick.Layouts 1.1 | 25 | import QtQuick.Layouts 1.1 | ||
25 | 26 | | |||
26 | import org.kde.kirigami 2.8 as Kirigami | 27 | import org.kde.kirigami 2.8 as Kirigami | ||
27 | 28 | | |||
28 | import org.kde.ksysguard.formatter 1.0 | 29 | import org.kde.ksysguard.sensors 1.0 as Sensors | ||
29 | import org.kde.ksysguard.sensors 1.0 | 30 | import org.kde.ksysguard.faces 1.0 as Faces | ||
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 ChartControls | ||
33 | | ||||
34 | ChartsControls.Legend { | | |||
35 | id: legend | | |||
36 | | ||||
37 | property alias textOnlySensorIds: textOnlySensorsRepeater.model | | |||
38 | property var sourceModel | | |||
39 | property var colorSource | | |||
40 | | ||||
41 | flow: GridLayout.TopToBottom | | |||
42 | 33 | | |||
43 | Layout.maximumHeight: implicitHeight | 34 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
44 | Layout.maximumWidth: parent.width | | |||
45 | 35 | | |||
46 | spacing: Kirigami.Units.smallSpacing | 36 | Faces.SensorFace { | ||
47 | 37 | id: root | |||
48 | valueVisible: true | 38 | contentItem: ColumnLayout { | ||
49 | valueWidth: units.gridUnit * 2 | 39 | LineChart { | ||
50 | formatValue: function(input, index) { | 40 | Layout.fillWidth: true | ||
51 | return Formatter.formatValueShowNull(input, sourceModel.data(sourceModel.index(0, index), SensorDataModel.Unit)) | 41 | Layout.fillHeight: true | ||
52 | } | 42 | Layout.alignment: Qt.AlignCenter | ||
53 | | ||||
54 | Repeater { | | |||
55 | id: textOnlySensorsRepeater | | |||
56 | delegate: ChartsControls.LegendDelegate { | | |||
57 | name: sensor.shortName | | |||
58 | value: sensor.formattedValue || "" | | |||
59 | colorVisible: false | | |||
60 | | ||||
61 | layoutWidth: legend.width | | |||
62 | valueWidth: units.gridUnit * 2 | | |||
63 | | ||||
64 | Sensor { | | |||
65 | id: sensor | | |||
66 | sensorId: modelData | | |||
67 | } | 43 | } | ||
44 | QQC2.Label { | ||||
45 | id: label | ||||
46 | visible: root.formFactor == Faces.SensorFace.Planar | ||||
47 | Layout.alignment: Qt.AlignHCenter | Qt.AlignTop | ||||
48 | text: root.controller.title | ||||
68 | } | 49 | } | ||
69 | } | 50 | } | ||
70 | } | 51 | } | ||
52 | |
as QQC2