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 import ThermoConfiguration 1.0 ThermoView { StatsContents { id: stats anchors.fill: parent } Image { anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: Theme.statsViewToggleTopMargin source: stats.selected === 0 ? "toggle-month.png" : "toggle-year.png" Text { color: stats.selected === 0 ? ColorStyle.blue : ColorStyle.greyDark4 font.pixelSize: Theme.statsViewButtonFontSize //% "Month" text: qsTrId("id-month") x: Theme.statsViewButtonMonthHCenter - width / 2 y: Theme.statsViewButtonVCenter - baselineOffset / 2 } Text { color: stats.selected === 1 ? ColorStyle.blue : ColorStyle.greyDark4 font.pixelSize: Theme.statsViewButtonFontSize //% "Year" text: qsTrId("id-year") x: Theme.statsViewButtonYearHCenter - width / 2 y: Theme.statsViewButtonVCenter - baselineOffset / 2 } MouseArea { height: parent.height width: parent.width / 2 onClicked: { if (stats.selected != 0) { stats.selected = 0; } } } MouseArea { height: parent.height width: parent.width / 2 x: parent.width / 2 onClicked: { if (stats.selected != 1) { stats.selected = 1; } } } } }