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

Item {
    id: root
    property int selected: GlobalState.statsContentViewIndex

    Image {
        source: "stats-month.png"
        visible: !selected
    }
    Image {
        source: "stats-year.png"
        visible: selected
    }
    Text {
        color: ColorStyle.greyDark1
        font.pixelSize: Theme.statsViewChartLabelFontSize
        horizontalAlignment: Text.AlignHCenter
        //% "Jan"
        text: selected ? qsTrId("id-jan") :
        //% "05/11"
        qsTrId("id-0511")
        width: 30
        x: Theme.isBig ? 149 : 87
        y: Theme.isBig ? 278 : 160
    }
    Text {
        color: ColorStyle.greyDark1
        font.pixelSize: Theme.statsViewChartLabelFontSize
        horizontalAlignment: Text.AlignHCenter
        //% "Feb"
        text: selected ? qsTrId("id-feb") :
        //% "05/12"
        qsTrId("id-0512")
        width: 30
        x: Theme.isBig ? 254 : 150
        y: Theme.isBig ? 278 : 160
    }
    Text {
        color: ColorStyle.greyDark1
        font.pixelSize: Theme.statsViewChartLabelFontSize
        horizontalAlignment: Text.AlignHCenter
        //% "Mar"
        text: selected ? qsTrId("id-mar") :
        //% "05/13"
        qsTrId("id-0513")
        width: 30
        x: Theme.isBig ? 361 : 213
        y: Theme.isBig ? 278 : 160
    }
    Text {
        color: ColorStyle.greyDark1
        font.pixelSize: Theme.statsViewChartLabelFontSize
        horizontalAlignment: Text.AlignHCenter
        //% "Apr"
        text: selected ? qsTrId("id-apr") :
        //% "05/14"
        qsTrId("id-0514")
        width: 30
        x: Theme.isBig ? 468 : 276
        y: Theme.isBig ? 278 : 160
    }
    Text {
        color: ColorStyle.greyDark1
        font.pixelSize: Theme.statsViewChartLabelFontSize
        horizontalAlignment: Text.AlignHCenter
        //% "May"
        text: selected ? qsTrId("id-may") :
        //% "05/15"
        qsTrId("id-0515")
        width: 30
        x: Theme.isBig ? 575 : 339
        y: Theme.isBig ? 278 : 160
    }
    Text {
        color: ColorStyle.greyDark1
        font.pixelSize: Theme.statsViewChartLabelFontSize
        horizontalAlignment: Text.AlignHCenter
        //% "Jun"
        text: selected ? qsTrId("id-jun") :
        //% "05/16"
        qsTrId("id-0516")
        width: 30
        x: Theme.isBig ? 681 : 402
        y: Theme.isBig ? 278 : 160
    }
}