From 5f6ad4e11970312ad8d2a57b2d3b2260d99cdb59 Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Tue, 9 Jul 2019 15:36:00 +0900 Subject: add new design --- app/NextCrossDistance.qml | 92 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 app/NextCrossDistance.qml (limited to 'app/NextCrossDistance.qml') 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 + } + + } + +} -- cgit 1.2.3-korg