C

Indicators: Creating Safety-Critical UI

/**************************************************************************** ** ** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Safe Renderer 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 https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ** ** ** ** ** ** ** ****************************************************************************/
import QtQuick 2.8 import Qt.SafeRenderer 1.2 import QtQuick.Extras 1.4 Rectangle { id: root width: 640 height: 480 color: "black" property alias text: safeText.text state: "A" Component.onCompleted: state = "B" Row { id: leftindicators x: 88 y: 40 width: 150 height: 30 anchors.right: parent.horizontalCenter anchors.rightMargin: 82 anchors.bottom: parent.bottom anchors.bottomMargin: 22 spacing: 8 SafePicture { id: iconBattery objectName: "iconBattery" width: 30 height: 30 color: "#e41e25" source: "qrc:/iso-icons/iso_grs_7000_4_0247.dat" } SafePicture { id: iconFuel objectName: "iconFuel" width: 30 height: 30 color: "#e41e25" source: "qrc:/iso-icons/iso_grs_7000_4_0245.dat" } SafePicture { id: iconParkingBrake objectName: "iconParkingBrake" width: 30 height: 30 color: "#e41e25" source: "qrc:/iso-icons/iso_grs_7000_4_0238.dat" } } Row { id: rightindicators y: 36 width: 150 height: 30 anchors.left: parent.horizontalCenter anchors.leftMargin: 32 anchors.bottom: parent.bottom anchors.bottomMargin: 22 spacing: 8 SafePicture { id: iconLowbeam objectName: "iconLowbeam" width: 30 height: 30 source: "qrc:/iso-icons/iso_grs_7000_4_0456.dat" color: "#5caa15" } SafePicture { id: iconTyre objectName: "iconTyre" width: 30 height: 30 color: "#face20" source: "qrc:/iso-icons/iso_grs_7000_4_1434A.dat" } SafePicture { id: iconLamp objectName: "iconLamp" width: 30 height: 30 source: "qrc:/iso-icons/iso_grs_7000_4_1555.dat" color: "#face20" } SafePicture { id: iconSeatbelt objectName: "iconSeatbelt" width: 30 height: 30 color: "#e41e25" source: "qrc:/iso-icons/iso_grs_7000_4_0249.dat" } } SafeText { id: safeText objectName: "safetextitem" x: 256 y: 208 width: 256 height: 128 color: "#8ae234" text: "0.0" font.family: "Lato" horizontalAlignment: Text.AlignLeft font.pixelSize: 32 runtimeEditable: true } SafePicture { id: car objectName: "car" x: 54 y: 37 opacity: 1.0 width: 64 height: 64 color: "#729fcf" source: "qrc:/iso-icons/iso_grs_7000_4_1358.dat" } states: [ State { name: "A" PropertyChanges { target: car x: 54 opacity: 1.0 } }, State { name: "B" PropertyChanges { target: car x: 540 opacity: 0.0 } } ] transitions: [ Transition { from: "A" to: "B" NumberAnimation { target: car properties: "x, y, opacity" duration: 1000 easing.type: Easing.InOutQuad } }, Transition { from: "B" to: "A" NumberAnimation { target: car properties: "x, y, opacity" duration: 1000 easing.type: Easing.InOutQuad } } ] }