C

Qt Quick Ultralite Motorcycle Cluster Demo

/****************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
import QtQuick import QtQuickUltralite.Extras 1.2 Row { id: root property int timeValueHours: 10 property int timeValueMinutes: 55 property color fontsColor function addZero (timeValue: int): string { return (timeValue < 10 ? "0" : "") + timeValue.toString(); } Text { id: timeInfoHours font.pixelSize: 24; font.family: "Barlow-mono"; color: fontsColor text: addZero(timeValueHours) } StaticText { id: timeInfoCollon text: ":" font.pixelSize: 24; font.family: "Barlow-mono"; color: fontsColor } Text { id: timeInfoMinutes font.pixelSize: 24; font.family: "Barlow-mono"; color: fontsColor text: addZero(timeValueMinutes) } Timer { interval: 1000*60// 1 minute running: true repeat: true onTriggered: { root.timeValueMinutes = (root.timeValueMinutes + 1)%60; if (0===root.timeValueMinutes) root.timeValueHours = (root.timeValueHours+1)%24; if (0 === root.timeValueHours) root.timeValueHours = 10; } } }