C
Qt Quick Ultralite Thermostat Demo
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
import QtQuick 2.15
import Thermo 1.0
Image {
id: weatherIcon
Behavior on opacity { NumberAnimation { duration: 200 } }
source: "weather/w_01.png";
readonly property list icons: [
"weather/w_01.png", "weather/w_02.png", "weather/w_03.png",
"weather/w_04.png", "weather/w_05.png", "weather/w_06.png",
"weather/w_07.png"
]
Timer {
running: GlobalState.weatherStatusTimerEnable
repeat: true
interval: 5000
onTriggered: {
if (Math.random() < 0.3) {
weatherIcon.source = weatherIcon.icons[Math.floor(Math.random() * 7)]
}
}
}
}