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 ClusterDemo 1.0 import "gauges" import Qt.SafeRenderer 2.0 import ".." Item { width: 1280 height: 720 property alias bottompanel: bottompanel property alias bottomPanelY: bottompanel.y property alias needleRotation: tachometer.speedometerNeedleRotation property alias meterOpacity: dashboardEntity.meterOpacity property alias speedometer: speedometer property alias tachometer: tachometer property alias speedText: speedText property alias smallMeter: smallMeter 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 iconTyre: iconTyre property alias iconLamp: iconLamp property alias iconSeatbelt: iconSeatbelt property alias safeText: safeText DashboardBackground { id: dashboardEntity width: 1280 height: 480 anchors.verticalCenter: parent.verticalCenter property real meterOpacity: 1.0 //gadget2.green: tachometer.actualValue < 4000 //TODO: gadget2.value: tachometer.actualValue //TODO: gadget2.maxValue: 8000 //gadget.green: speedometer.actualValue < 100 //TODO: gadget.value: speedometer.actualValue // Fuelmeter SmallMeter { id: fuelMeter anchors.rightMargin: -1 anchors.leftMargin: 1 anchors.bottomMargin: 3 anchors.top: batteryMeter.bottom anchors.right: batteryMeter.left anchors.bottom: batteryMeter.top anchors.left: batteryMeter.right value: ValueSource.fuelLevel opacity: dashboardEntity.meterOpacity } // Batterymeter SmallMeter { id: batteryMeter x: 716 y: 28 width: 144 height: 144 anchors.top: parent.top anchors.topMargin: 28 anchors.right: parent.right anchors.rightMargin: 421 value: ValueSource.batteryLevel opacity: dashboardEntity.meterOpacity maxValueAngle: 317 minValueAngle: 225 maximumValue: 100 degreesPerValue: Math.abs( (maxValueAngle - minValueAngle) / maximumValue) rotationOffset: 135 direction: -1 } Image { source: "image://etc/gaugeCenterSmall.png" anchors.centerIn: batteryMeter width: 52 height: 52 } // Consumptionmeter ConsumptionMeter { anchors.top: parent.top anchors.topMargin: 243 anchors.rightMargin: 276 anchors.right: parent.right opacity: dashboardEntity.meterOpacity } // Temperaturemeter TemperatureMeter { opacity: dashboardEntity.meterOpacity } // Turbometer SmallMeter { id: smallMeter x: 414 y: 28 width: 144 height: 144 anchors.top: parent.top anchors.topMargin: 25 anchors.left: parent.left anchors.leftMargin: 414 opacity: dashboardEntity.meterOpacity value: ValueSource.rpm / 2000. maxValueAngle: 270 minValueAngle: 0 maximumValue: 4.0 degreesPerValue: Math.abs( (maxValueAngle - minValueAngle) / maximumValue) } Image { source: "image://etc/gaugeCenterSmall.png" anchors.centerIn: smallMeter width: 52 height: 52 } // Fpsmeter FpsMeter { id: fpsMeter x: 583 anchors.rightMargin: 590 anchors.topMargin: 86 opacity: dashboardEntity.meterOpacity } Image { source: "image://etc/gaugeCenterSmall.png" anchors.centerIn: fpsMeter width: 52 height: 52 } // Bottom Panel BottomPanel { id: bottompanel y: 402 width: 820 height: 92 anchors.horizontalCenter: parent.horizontalCenter Row { id: leftindicators x: 205 y: 41 width: 180 height: 30 anchors.right: parent.horizontalCenter anchors.rightMargin: 32 anchors.bottom: parent.bottom anchors.bottomMargin: 22 spacing: 8 TurnLeft { id: turnleft width: 30 height: 30 } SafePicture { id: iconCoolant objectName: "iconCoolant" width: 30 height: 30 color: "blue" source: "qrc:/iso-icons/iso_grs_7000_4_2426.dat" } 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: 180 height: 30 anchors.left: parent.horizontalCenter anchors.leftMargin: 32 anchors.bottom: parent.bottom anchors.bottomMargin: 22 spacing: 8 SafePicture { id: iconLights objectName: "iconLights" 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" } TurnRight { id: turnright width: 30 height: 30 } } } LargeMeter { id: speedometer opacity: dashboardEntity.meterOpacity x: 106 y: 70 actualValue: ValueSource.kph } LargeMeter { id: tachometer x: 831 y: 68 width: 343 height: 343 opacity: dashboardEntity.meterOpacity minValueAngle: 55 maxValueAngle: 255 minimumValue: 0 maximumValue: 8000 limitValue: 4000 } SafeText { id: speedText objectName: "speedText" x: 232 y: 320 height: 52 width: 92 font.pixelSize: 48 font.family: "Lato" color: "lightGray" text: "10" runtimeEditable: true horizontalAlignment: Text.AlignHCenter opacity: dashboardEntity.meterOpacity } Text { id: speedUnitText anchors.top: speedText.bottom font.pixelSize: 18 color: "lightGray" text: "KM/H" anchors.horizontalCenter: speedText.horizontalCenter opacity: dashboardEntity.meterOpacity } Text { id: textEco anchors.horizontalCenter: speedometer.horizontalCenter text: tachometer.actualValue > 4000 ? "POWER" : "ECO" anchors.verticalCenterOffset: 0 anchors.horizontalCenterOffset: 724 anchors.verticalCenter: tachometer.verticalCenter font.pixelSize: 18 visible: false color: tachometer.actualValue <= 4000 ? "white" : "red" opacity: dashboardEntity.meterOpacity } SafeText { id: safeText objectName: "safeText" x: 533 y: 277 width: 231 height: 68 color: "#face21" text: "Error occurred. Recovering.." wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter font.pixelSize: 20 } } }