C
Qt Quick Ultralite Thermostat Demo
/****************************************************************************** ** ** 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$ ** ******************************************************************************/import QtQuick 2.15 import Thermo 1.0 Item { id: root property int maxIndex: 48 signal roomSwitched() onRoomSwitched: { rightHandleAnimation.enabled = GlobalState.scheduleViewLoaded leftHandleAnimation.enabled = GlobalState.scheduleViewLoaded leftHandle.x = GlobalState.selectedRoom.leftHandleX rightHandle.x = GlobalState.selectedRoom.rightHandleX } Image { id: background anchors.verticalCenter: parent.verticalCenter source: "scrollbar-off-track.png" } Rectangle { id: middleBackground anchors.verticalCenter: parent.verticalCenter anchors.left: leftHandle.horizontalCenter anchors.right: rightHandle.horizontalCenter height: background.height color: ColorStyle.greyMedium3 } TimeIntervalSliderHandle { id: leftHandle minX: 0 maxX: rightHandle.x - width x: GlobalState.selectedRoom.leftHandleX onXChanged: GlobalState.selectedRoom.leftHandleX = leftHandle.x currentIndex: leftHandle.x/(root.width-rightHandle.width) * root.maxIndex y: -height/2 + parent.height/2 Behavior on x { id: leftHandleAnimation enabled: GlobalState.scheduleViewLoaded NumberAnimation { onRunningChanged: { if (!running) { leftHandleAnimation.enabled = false } } } } } TimeIntervalSliderHandle { id: rightHandle minX: leftHandle.x + width maxX: root.width - width x: GlobalState.selectedRoom.rightHandleX onXChanged: GlobalState.selectedRoom.rightHandleX = rightHandle.x currentIndex: rightHandle.x/(root.width-rightHandle.width) * root.maxIndex y: -height/2 + parent.height/2 Behavior on x { id: rightHandleAnimation enabled: GlobalState.scheduleViewLoaded NumberAnimation { onRunningChanged: { if (!running) { rightHandleAnimation.enabled = false } } } } } }