C

Event Sender: Sending Messages to Applications

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

// This file is part of the Qt Safe Renderer module
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt.SafeRenderer

Item {
    id: mainSlide
    y: 275
    x: 20

    Label {
        width: slider.width
        wrapMode: Label.Wrap
        horizontalAlignment: Qt.AlignHCenter
        y: 305
        x: 20
        text: "Change the speed."
    }

    Slider {
        id: slider
        from: 0
        to: 200
        stepSize: 1
        value: 0
        y: 285
        x: 20

        background: Rectangle {
            x: slider.leftPadding
            y: slider.topPadding + slider.availableHeight / 2 - height / 2
            implicitWidth: 200
            implicitHeight: 4
            width: slider.availableWidth
            height: implicitHeight
            radius: 2
            color: "#cecfd5"

            Rectangle {
                width: slider.visualPosition * parent.width
                height: parent.height
                color: "#41cd52"
                radius: 2
            }
        }

        handle: Rectangle {
            x: slider.leftPadding + slider.visualPosition * (slider.availableWidth - width)
            y: slider.topPadding + slider.availableHeight / 2 - height / 2
            implicitWidth: 26
            implicitHeight: 26
            radius: 13
            color: slider.pressed ? "#f0f0f0" : "#f6f6f6"
            border.color: "#cecfd5"
        }

        onValueChanged: {
            if (slider.value >= 1 && slider.value <= 199) {
                clusterDataControl.vehicleSpeed = slider.value + stepSize
                clusterDataControl.rpm = slider.value * 40
                //QSafeMessageSender.setText("speedText", slider.value + stepSize)
            } else {
                clusterDataControl.vehicleSpeed = slider.value
                //clusterDataControl.rpm = slider.value / 40
                //QSafeMessageSender.setText("speedText", slider.value)
            }
        }
        }
}