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$ ** ******************************************************************************/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; } } } } }