diff options
Diffstat (limited to 'app/NextCrossDistance.qml')
-rw-r--r-- | app/NextCrossDistance.qml | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/app/NextCrossDistance.qml b/app/NextCrossDistance.qml new file mode 100644 index 0000000..7719976 --- /dev/null +++ b/app/NextCrossDistance.qml @@ -0,0 +1,92 @@ +import QtQuick 2.0 +import QtQuick.Layouts 1.1 + +Item { + id: root + property int units: 0 + property int tens: 0 + property int hundreds: 0 + ListModel { + id: model + ListElement { + name: "0" + picturePath: "qrc:tbt_0.png" + } + ListElement { + name: "1" + picturePath: "qrc:tbt_1.png" + } + ListElement { + name: "2" + picturePath: "qrc:tbt_2.png" + } + ListElement { + name: "3" + picturePath: "qrc:tbt_3.png" + } + ListElement { + name: "4" + picturePath: "qrc:tbt_4.png" + } + ListElement { + name: "5" + picturePath: "qrc:tbt_5.png" + } + ListElement { + name: "6" + picturePath: "qrc:tbt_6.png" + } + ListElement { + name: "7" + picturePath: "qrc:tbt_7.png" + } + ListElement { + name: "8" + picturePath: "qrc:tbt_8.png" + } + ListElement { + name: "9" + picturePath: "qrc:tbt_9.png" + } + } + + RowLayout { + anchors.fill: parent + Image { + id: hundreds_image + width: parent.width * 0.25 + } + Image { + id: tens_image + width: parent.width * 0.25 + } + Image { + id: units_image + width: parent.width * 0.25 + source: "qrc:tbt_0.png" + } + Image { + id: metre_image + width: parent.width * 0.25 + source: "qrc:tbt_m.png" + } + } + + function setCorssDistance(dis) { + hundreds = dis / 100 % 10 + tens = dis / 10 % 10 + units = dis % 10 + if(hundreds != 0) { + hundreds_image.source = model.get(hundreds).picturePath + tens_image.source = model.get(tens).picturePath + units_image.source = model.get(units).picturePath + } else { + if(tens != 0) { + tens_image.source = model.get(tens).picturePath + } + units_image.source = model.get(units).picturePath + } + + } + +} |