C

Qt Quick Ultralite 智能恒温器演示

/****************************************************************************** ** ** Copyright (C) 2023 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$ ** ******************************************************************************/
pragma Singleton import QtQuick 2.15 QtObject { property Room diningRoom: Room { id: diningRoom fan: Room.FanQuarter //% "First floor" floor: qsTrId("id-firstfloor") //% "Dining room" name: qsTrId("id-diningroom") status: Room.Cooling temperature: Units.fahrenheitToTemperatureUnit(71) } property Room garageRoom: Room { id: garageRoom //% "First floor" floor: qsTrId("id-firstfloor") //% "Garage" name: qsTrId("id-garage") status: Room.Heating temperature: Units.fahrenheitToTemperatureUnit(68) } property Room kids2Room: Room { id: kids2Room fan: Room.FanFull //% "Second floor" floor: qsTrId("id-secondfloor") //% "Kids bedroom 2" name: qsTrId("id-kidsbedroom2") status: Room.Heating temperature: Units.fahrenheitToTemperatureUnit(71) } property Room kidsRoom: Room { id: kidsRoom //% "Second floor" floor: qsTrId("id-secondfloor") //% "Kids bedroom" name: qsTrId("id-kidsbedroom") status: Room.Cooling temperature: Units.fahrenheitToTemperatureUnit(65) } property Room kitchenRoom: Room { id: kitchenRoom //% "First floor" floor: qsTrId("id-firstfloor") //% "Kitchen" name: qsTrId("id-kitchen") power: false status: Room.Cooling temperature: Units.fahrenheitToTemperatureUnit(68) } property Room livingRoom: Room { id: livingRoom fan: Room.FanHalf //% "First floor" floor: qsTrId("id-firstfloor") leftHandleX: 40 //% "Living room" name: qsTrId("id-livingroom") rightHandleX: 180 status: Room.Heating temperature: Units.fahrenheitToTemperatureUnit(69) } function getByIndex(index: int): Room { switch (index) { case 0: return Rooms.livingRoom; case 1: return Rooms.diningRoom; case 2: return Rooms.kitchenRoom; case 3: return Rooms.kidsRoom; case 4: return Rooms.kids2Room; case 5: return Rooms.garageRoom; default: return Rooms.livingRoom; } } }