C
Qt Quick Ultralite Thermostat Demo
// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial 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 } } } }