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 } }