C
Qt Quick Ultralite freertos_multitask Example
/****************************************************************************** ** ** 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 2.15 Rectangle { id: root Image { id: background source: "images/background-dark.png" anchors.fill: root } Row { anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: 10 Text { color: "white" text: "Speed: " font.pixelSize: 30; } Text { color: "white" text: FanControl.speed font.pixelSize: 30; } } Text { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom anchors.bottomMargin: 10 color: "gray" text: "Tap to change fan and LED speed!" } Image { id: fan source: "images/fan-off.png" anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter transform: Rotation { origin.x: fan.width / 2 origin.y: fan.height / 2 RotationAnimation on angle { loops: Animation.Infinite from: 0 to: 360 duration: FanControl.speed === 0 ? 0 : 5000 / (FanControl.speed * 3) running: FanControl.speed > 0 ? true : false } } } MouseArea { id: ta anchors.fill: parent onPressed: { FanControl.updateSpeed((FanControl.speed + 1) % 6); } } }