C

Qt Quick Ultralite Thermostat Demo

/****************************************************************************** ** ** 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 import Thermo 1.0 Item { id: window width: Theme.screenWidth height: Theme.screenHeight property int selectedView: 0 Image { anchors.fill: parent source: "main-bg.png" } TopBar { id: topBar width: parent.width height: Theme.topBarHeight showBackButton: !places.showMain title: places.currentRoom.name onBackClicked: { places.showMain = true } onSettingsClicked: { languageDialog.show() } } Item { id: mainItem width: parent.width anchors.top: topBar.bottom height: parent.height - topBar.height - bottomBar.height property int currentViewIndex: 0 PlacesView { id: places enabled: window.selectedView === 0 && showMain visible: opacity > 0.01 width: parent.width height: parent.height showMain: true onShowMainChanged: { window.selectedView = !showMain ? 5 : 0 } selectedView: window.selectedView index: 0 } RoomView { id: roomView anchors.top: parent.top anchors.bottom: parent.bottom anchors.bottomMargin: -Theme.bottomBarHeight // No BottomBar in the RoomView visible: opacity > 0.01 currentRoom: places.currentRoom width: parent.width selectedView: window.selectedView index: 5 } ScheduleView { anchors.fill: parent enabled: window.selectedView === 1 visible: opacity > 0.01 selectedView: window.selectedView index: 1 } StatsView { anchors.fill: parent anchors.topMargin: Theme.statsTopGradientSpacer // The view is opaque, reserve space for the background gradient enabled: window.selectedView === 2 visible: opacity > 0.01 selectedView: window.selectedView index: 2 } } BottomBar { id:bottomBar z: 10 // give precedence to bottom bar touch areas width: parent.width height: Theme.bottomBarHeight selected: window.selectedView onViewSwitched: window.selectedView = index anchors.bottom: parent.bottom property int shift: !places.showMain ? -height : 0 visible: shift > -height Behavior on shift { NumberAnimation { } } anchors.bottomMargin: shift } LanguageDialog { id: languageDialog anchors.fill: parent z: 11 } }