From 8825bca5587ba07e7462622ba37d125ba17e4969 Mon Sep 17 00:00:00 2001 From: dodoradio Date: Mon, 7 Aug 2023 21:25:44 +0100 Subject: Add barometer graph This is based mostly on my work from asteroid-health (https://git.dodorad.io/dodoradio/asteroid-health). Some tweaks have been applied on top of this code, which might prove useful in asteroid-health as well. --- src/Barometer.qml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/Barometer.qml') diff --git a/src/Barometer.qml b/src/Barometer.qml index c34f51d..b494fc0 100644 --- a/src/Barometer.qml +++ b/src/Barometer.qml @@ -23,6 +23,7 @@ import QtSensors 5.11 import org.asteroid.controls 1.0 import org.asteroid.utils 1.0 import Nemo.Configuration 1.0 +import "graphs" Item { id: barometerRoot @@ -38,14 +39,23 @@ Item { width: parent.width*0.2 height: width anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: pressureText.top + anchors.bottom: baroGraph.top + } + BarometerGraph { + id: baroGraph + height: parent.height/3 + width: parent.width*7/8 + anchors.centerIn: parent } Label { id: pressureText - anchors.centerIn: parent + anchors.top:baroGraph.bottom + anchors.topMargin: parent.height*0.05 + anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter text: (pressureSensor.reading.pressure + barometerOffset.value)/100 - font.pixelSize: parent.height / 4 + font.pixelSize: parent.height / 12 + font.bold: true } ConfigurationValue { id: barometerOffset @@ -57,6 +67,6 @@ Item { anchors.top: pressureText.bottom horizontalAlignment: Text.AlignHCenter text: "hPa" - font.pixelSize: parent.height / 6 + font.pixelSize: parent.height / 18 } } -- cgit v1.2.3-54-g00ecf