C
Qt Quick Ultralite Motorcycle Cluster Demo
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
import QtQuick
import QtQuickUltralite.Extras 2.0
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: 36;
font.family: "Barlow-mono";
color: fontsColor
text: addZero(timeValueHours)
}
StaticText
{
id: timeInfoCollon
text: ":"
font.pixelSize: 36;
font.family: "Barlow-mono";
color: fontsColor
}
Text
{
id: timeInfoMinutes
font.pixelSize: 36;
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;
}
}
}