diff options
| author | Oskari Timperi <oskari.timperi@iki.fi> | 2013-12-07 17:33:25 +0200 |
|---|---|---|
| committer | Oskari Timperi <oskari.timperi@iki.fi> | 2013-12-07 17:33:25 +0200 |
| commit | ef5baad9ff47cfe32bb4f97368e0b3148765caa6 (patch) | |
| tree | 87d59ecc69e7981489e16aeed62115b4a4927223 /src/qml/pages/PressureModel.qml | |
| parent | 3aeb00f43988ae607082cdabe124b9d5e123e33c (diff) | |
| download | unitmaster-ef5baad9ff47cfe32bb4f97368e0b3148765caa6.tar.gz unitmaster-ef5baad9ff47cfe32bb4f97368e0b3148765caa6.zip | |
shuffle stuff around and add directory for tests
Diffstat (limited to 'src/qml/pages/PressureModel.qml')
| -rw-r--r-- | src/qml/pages/PressureModel.qml | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/qml/pages/PressureModel.qml b/src/qml/pages/PressureModel.qml new file mode 100644 index 0000000..2196f8a --- /dev/null +++ b/src/qml/pages/PressureModel.qml @@ -0,0 +1,71 @@ +import QtQuick 2.0 + +ListModel { + function from(title, value) { + var functions = { + "pascal": function () { return value; }, + "kilopascal": function () { return value*1000; }, + "bar": function () { return value*1e5; }, + "millibar": function () { return value*100.0; }, + "pounds per square inch": function () { return value*(6.8948e3); }, + "technical atmosphere": function () { return value*0.980665e5; }, + "standard atmosphere": function () { return value*1.01325e5; }, + "torr": function () { return value*133.3224; } + }; + return functions[title](); + } + + function to(title, value) { + var functions = { + "pascal": function () { return value; }, + "kilopascal": function () { return value/1000; }, + "bar": function () { return value/1e5; }, + "millibar": function () { return value/100.0; }, + "pounds per square inch": function () { return value/(6.8948e3); }, + "technical atmosphere": function () { return value/(0.980665e5); }, + "standard atmosphere": function () { return value/(1.01325e5); }, + "torr": function () { return value/133.3224; } + }; + return functions[title](); + } + + ListElement { + title: "pascal" + abbr: "Pa" + } + + ListElement { + title: "kilopascal" + abbr: "kPa" + } + + ListElement { + title: "bar" + abbr: "" + } + + ListElement { + title: "millibar" + abbr: "mbar" + } + + ListElement { + title: "pounds per square inch" + abbr: "psi" + } + + ListElement { + title: "technical atmosphere" + abbr: "at" + } + + ListElement { + title: "standard atmosphere" + abbr: "atm" + } + + ListElement { + title: "torr" + abbr: "" + } +} |
