C

Qt Quick Ultralite Automotive Cluster Demo

// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial

import QtQuick 2.15
import Automotive 1.0

Column {
    id: driveModeSelector
    spacing: 15
    Repeater {
        model: ListModel {
            ListElement { img: "images/gauge-normal.png"; txt: "Normal"; }
            ListElement { img: "images/sport.png"; txt: "Sport"; }
        }
        delegate: Item {
            width: driveModeSelector.width;
            height: 24
            opacity: index == SettingsMenuModel.currentDriveModeSelected ? 1.0 : 0.3
            Row {
                height: 24;
                spacing: 17
                Image {
                    source: model.img;
                }
                Text {
                    text: model.txt;
                    font.pixelSize: 20;
                    color: Style.lightPeriwinkle;
                    font.family: "Sarabun";
                }
            }

            Behavior on opacity {
                NumberAnimation {
                    duration: 150
                }
            }
        }
    }
}