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 QtQuickUltralite.Extras 2.0 import Thermo 1.0 ThermoView { id: root property int cardSizeWithSpacing: Theme.cardRowSpacing + Theme.cardWidth property int pageCount: 6 Component.onCompleted: { GlobalState.placesLoaded = true } Flickable { id: swipeView interactive: GlobalState.showMain anchors.fill: parent contentWidth: root.pageCount * root.cardSizeWithSpacing + 2 * Theme.cardRowOffset contentHeight: swipeView.height contentX: GlobalState.cardX onContentXChanged: GlobalState.cardX = swipeView.contentX CardRow { id: cardRow x: Theme.cardRowOffset y: 30 spacing: Theme.cardRowSpacing } } property real delta: swipeView.contentX / (swipeView.contentWidth - swipeView.width + 0.001) // ensure range is [0..1) Row { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom anchors.bottomMargin: Theme.cardRowIndicatorBottomMargin spacing: Theme.cardRowIndicatorSpacing Repeater { model: 4 delegate: ColorizedImage { required property int index property bool isCurrent: Math.floor(4 * root.delta) == index source: "page-indicator.png" color: isCurrent ? ColorStyle.greyMedium2 : ColorStyle.greyDark1 } } } }