summaryrefslogtreecommitdiffstats
path: root/app/TotalDistance.qml
blob: c8fadebc6ea161dcdb661c84f653ae574bd297bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import QtQuick 2.0
import QtQuick.Layouts 1.1

Item {
    id: root
    property int units: 0
    property int tenths: 0
    ListModel {
        id: model
        ListElement {
            name: "0"
            picturePath: "qrc:no_0.png"
        }
        ListElement {
            name: "1"
            picturePath: "qrc:no_1.png"
        }
        ListElement {
            name: "2"
            picturePath: "qrc:no_2.png"
        }
        ListElement {
            name: "3"
            picturePath: "qrc:no_3.png"
        }
        ListElement {
            name: "4"
            picturePath: "qrc:no_4.png"
        }
        ListElement {
            name: "5"
            picturePath: "qrc:no_5.png"
        }
        ListElement {
            name: "6"
            picturePath: "qrc:no_6.png"
        }
        ListElement {
            name: "7"
            picturePath: "qrc:no_7.png"
        }
        ListElement {
            name: "8"
            picturePath: "qrc:no_8.png"
        }
        ListElement {
            name: "9"
            picturePath: "qrc:no_9.png"
        }
    }

    RowLayout {
        anchors.fill: parent
        Image {
            id: units_image
            width: parent.width * 0.45
            source: "qrc:no_0.png"
        }
        Image {
            id: point_image
            width: parent.width * 0.1
            source: "qrc:no_comma.png"
        }
        Image {
            id: tenths_image
            width: parent.width * 0.45
            source: "qrc:no_0.png"
        }
    }

    function setTotalDistance(dis) {
        units = dis % 10
        tenths = (dis - units) * 10
        units_image.source = model.get(units).picturePath
        tenths_image.source = model.get(tenths).picturePath
    }

}