@@ -2,13 +2,15 @@ import QtQuick 2.0
22
33Item {
44 property real valueIn: 0
5- property real valueOut: convertUnit ( valueIn)
5+ readonly property real valueOut: valueIn * scaleFactor
66 property int inUnit: 0
77 property int outUnit: 0
88 readonly property real scaleFactor: unitTable[inUnit] * (1 / unitTable[outUnit])
99 readonly property string inUnitName: unitNames[inUnit]
1010 readonly property string outUnitName: unitNames[outUnit]
1111
12+ /*
13+ // Enums supprted in Qt >= 5.10 - enable when it time comes.
1214 enum Unit {
1315 NoUnit,
1416 VelocityKnots,
@@ -23,12 +25,22 @@ Item {
2325 TurnRateRPM,
2426 TurnRateRadiansPerSecond
2527 }
28+ */
29+ readonly property int uNoUnit: 0
30+ readonly property int uVelocityKnots: 1
31+ readonly property int uVelocityMS: 2
32+ readonly property int uVelocityKMH: 3
33+ readonly property int uVelocityFPM: 4
34+ readonly property int uDistanceMeters: 5
35+ readonly property int uDistanceFeet: 6
36+ readonly property int uPressurehPa: 7
37+ readonly property int uPressureInHG: 8
38+ readonly property int uPressureBar: 9
39+ readonly property int uTurnRateRPM: 10
40+ readonly property int uTurnRateRadiansPerSecond: 11
41+
2642 // Conversion table from unit to SI standard unit
2743 readonly property var unitTable: [1 , 0.514444 , 1 , 0.277778 , 0.00508 , 1 , 0.3048 , 1 , 33.86 , 1000 , 1 , 9.549296586 ]
2844 // Unit names
2945 readonly property var unitNames: [" No unit" , " Knots" , " m/s" , " km/h" , " fpm" , " m" , " ft" , " hPa" , " InHg" , " Bar" , " RPM" , " Rad/s" ]
30-
31- function convertUnit (value ) {
32- return value * scaleFactor
33- }
3446}
0 commit comments