C

Qt Cluster: Rendering on QNX and INTEGRITY

/**************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** 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. ** ** BSD License Usage ** Alternatively, you may use this file under the terms of the BSD license ** as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of The Qt Company Ltd nor the names of its ** contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/
import QtQuick 2.6 import ".." import "." import ClusterDemo 1.0 import Qt.SafeRenderer 1.2 Item { id: root width: 1280 height: 720 property alias camera: camera property alias car: car property alias speedoMeter: speedoMeter property alias flipable: flipable property bool startupAnimationStopped: false property int gaugeDemoTime: 1000 property alias centerStack: centerStack // duration (/2) of the gauge needle animation at startup property alias turnIndicatorLeft: turnleft property alias turnIndicatorRight: turnright property alias iconCoolant: iconCoolant property alias iconBattery: iconBattery property alias iconFuel: iconFuel property alias iconParkingBrake: iconParkingBrake property alias iconLights: iconLights property alias iconLowbeam: iconLowBeam property alias iconTyre: iconTyre property alias iconLamp: iconLamp property alias iconSeatbelt: iconSeatbelt property alias speedText: speedText // TODO: Needed, as background clearing gets messed up after hybrid 3D Rectangle { anchors.fill: parent color: "black" z: -1 } Image { id: frame y: 120 source: "image://etc/DashboardFrameSport-mask.png" z: 2 } //where? CameraLoader { id: camera width: parent.width / 2.5 height: parent.height - 180 anchors.centerIn: parent } // comment ifndef QT_3DCORE_LIB CarLoader { id: car width: parent.width / 2.5 height: parent.height - 180 anchors.centerIn: parent } // end comment Item { id: container width: root.width height: 480 anchors.verticalCenterOffset: 0 anchors.horizontalCenterOffset: 0 anchors.centerIn: parent SpeedoMeterLoader { id: speedoMeter anchors.left: parent.left anchors.leftMargin: 48 anchors.top: parent.top anchors.topMargin: 67 height: 380 value: 33 width: 380 z: 4 } SafePicture { id: iconTyre objectName: "iconTyre" width: 48 height: 48 anchors.right: iconParkingBrake.left anchors.bottom: iconParkingBrake.bottom anchors.bottomMargin: 18 color: "#face20" source: "qrc:/iso-icons/iso_grs_7000_4_1434A.dat" z: 4 } SafeText { id: speedText objectName: "speedText" anchors.horizontalCenter: speedoMeter.horizontalCenter anchors.top: speedoMeter.top anchors.topMargin: 105 font.pixelSize: 72 color: "white" width: 256 height: 76 text: "10" verticalAlignment: Text.AlignTop anchors.horizontalCenterOffset: 0 font.family: "Lato" horizontalAlignment: Text.AlignHCenter runtimeEditable: true } SafeText { id: kmText objectName: "kmText" text: "km/h" verticalAlignment: Text.AlignTop font.italic: true anchors.horizontalCenterOffset: 0 anchors.topMargin: 0 color: "white" width: 60 height: 30 font.pixelSize: 25 font.family: "Lato" horizontalAlignment: Text.AlignHCenter anchors.top: speedText.bottom anchors.horizontalCenter: speedoMeter.horizontalCenter } SafePicture { id: iconParkingBrake objectName: "iconParkingBrake" width: 48 height: 48 anchors.centerIn: speedoMeter anchors.verticalCenterOffset: 48 anchors.horizontalCenterOffset: 0 color: "#e41e25" source: "qrc:/iso-icons/iso_grs_7000_4_0238.dat" z: 4 } SafePicture { id: iconFuel objectName: "iconFuel" width: 48 height: 48 anchors.left: iconParkingBrake.right anchors.bottom: iconParkingBrake.bottom anchors.bottomMargin: 18 color: "#e41e25" source: "qrc:/iso-icons/iso_grs_7000_4_0245.dat" z: 4 } CenterStack { id: centerStack viewIndex: 3 anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: 83 } RPMFlipable { id: flipable anchors.right: parent.right anchors.rightMargin: 50 anchors.top: parent.top anchors.topMargin: 69 width: 380 height: 380 rpmValue: 2212 flipped: false z: 4 } SafePicture { id: iconBattery objectName: "iconBattery" width: 48 height: 48 anchors.centerIn: flipable anchors.verticalCenterOffset: 24 anchors.horizontalCenterOffset: -24 source: "qrc:/iso-icons/iso_grs_7000_4_0247.dat" color: "#e41e25" z: 4 } SafePicture { id: iconCoolant objectName: "iconCoolant" width: 48 height: 48 anchors.centerIn: flipable anchors.verticalCenterOffset: 24 anchors.horizontalCenterOffset: 24 source: "qrc:/iso-icons/iso_grs_7000_4_0246.dat" color: "blue" z: 4 } } Item { width: speedoMeter.width anchors.horizontalCenter: parent.horizontalCenter anchors.top: pilotLights.top SafeImage { id: turnleft objectName: "turnleft" anchors.left: parent.left source: "qrc:/images/Icon_TurnLeft_ON.png" width: 48 height: 48 opacity: 1.0 states: [ State { name: "visible" PropertyChanges { target: turnleft opacity: 1.0 } }, State { name: "hidden" PropertyChanges { target: turnleft opacity: 0.0 } } ] transitions: [ Transition { from: "*" to: "*" NumberAnimation { target: turnleft properties: "opacity" duration: 1000 easing.type: Easing.InOutQuad } } ] } SafeImage { id: turnright objectName: "turnright" anchors.right: parent.right source: "qrc:/images/Icon_TurnRight_ON.png" width: 48 height: 48 opacity: 1.0 states: [ State { name: "visible" PropertyChanges { target: turnright opacity: 1.0 } }, State { name: "hidden" PropertyChanges { target: turnright opacity: 0.0 } } ] transitions: [ Transition { from: "*" to: "*" NumberAnimation { target: turnright properties: "opacity" duration: 1000 easing.type: Easing.InOutQuad } } ] } z: 3 } Item { id: bottomRow height: 68 width: 320 anchors.bottom: parent.bottom anchors.bottomMargin: 130 anchors.horizontalCenter: parent.horizontalCenter z: 3 property int pixelSize: 17 Text { text: ValueSource.date color: "white" font.pixelSize: bottomRow.pixelSize anchors.right: temperature.left anchors.rightMargin: 15 } Text { id: temperature text: "+18°C" color: "white" font.pixelSize: bottomRow.pixelSize anchors.right: time.left anchors.rightMargin: 15 } Text { id: time text: ValueSource.time color: "white" font.pixelSize: bottomRow.pixelSize anchors.right: parent.right } } Row { id: pilotLights anchors.horizontalCenter: parent.horizontalCenter y: 143 spacing: 2 z: 3 width: 200 SafePicture { id: iconLights objectName: "iconLights" width: 48 height: 48 color: "#5caa15" source: "qrc:/iso-icons/iso_grs_7000_4_0456.dat" } SafePicture { id: iconSeatbelt objectName: "iconSeatbelt" width: 48 height: 48 color: "#e41e25" source: "qrc:/iso-icons/iso_grs_7000_4_0249.dat" } SafePicture { id: iconLowBeam objectName: "iconLowBeam" width: 48 height: 48 color: "#e41e25" source: "qrc:/iso-icons/iso_grs_7000_4_0083.dat" } SafePicture { id: iconLamp objectName: "iconLamp" width: 48 height: 48 color: "#face20" source: "qrc:/iso-icons/iso_grs_7000_4_1555.dat" } } VehicleInfoNote { anchors.bottom: car.bottom visible: noteVisible && highlightType && !car.hidden id: alertNote textColor: "orange" //"#3a98c4" fixedPositionX: centerStack.x + (centerStack.width / 2) } SafeText { id: safeText objectName: "safeText" x: 533 y: 277 width: 215 height: 68 color: "#face20" text: "Error occurred. Recovering.." wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter font.pixelSize: 20 visible: false } // end comment }