diff options
author | 2024-09-10 19:15:25 +0900 | |
---|---|---|
committer | 2024-09-11 18:40:18 +0900 | |
commit | 5c8f09d2c3c99f621b467ed5c1be4fac3a708e85 (patch) | |
tree | 9312e269961b14945a00db47ed236ca53ffbb149 /GUIModel/Meter/Tachometer.qml | |
parent | 17b016d08cf1680f58cbb9102f35949c8436207c (diff) |
Port the cluster-refgui demo supports both Qt5 and Qt6HEADtrout_19.90.0trout/19.90.019.90.0master
This demo can now run on both Qt5 and Qt6, also added a macro to switch with or without the backend so that it can be developed easily on the Windows desktop.
Bug-AGL: SPEC-5243
Change-Id: I99b12ad9779a477784df13b83a850387747bb588
Signed-off-by: Jiu Shanheng <shanheng.jiu@qt.io>
Diffstat (limited to 'GUIModel/Meter/Tachometer.qml')
-rw-r--r-- | GUIModel/Meter/Tachometer.qml | 105 |
1 files changed, 51 insertions, 54 deletions
diff --git a/GUIModel/Meter/Tachometer.qml b/GUIModel/Meter/Tachometer.qml index 9ad0d7a..9974eea 100644 --- a/GUIModel/Meter/Tachometer.qml +++ b/GUIModel/Meter/Tachometer.qml @@ -15,7 +15,7 @@ */ import QtQuick 2.14 -import QtGraphicalEffects 1.14 +import "qrc:/MeterEffect/" Item { id: tachometer @@ -26,103 +26,100 @@ Item { onTachoValueChanged: { limitTachoValue(); - effectRpm.angle = (0.03375 * tachoValue*Math.PI/180)+effectRpm.angleBase + effectRpm.angle = (0.03375 * tachoValue * Math.PI / 180) + effectRpm.angleBase; } - Connections{ + Connections { target: rootItem - onTransNormalToAdas:{ - normalToAdasAnimation.start() + onTransNormalToAdas: { + normalToAdasAnimation.start(); } } - function limitTachoValue(){ - if(tachoValue > tachoValueMax){ - tachoValue = tachoValueMax - }else if(tachoValue < tachoValueMin){ - tachoValue = tachoValueMin + function limitTachoValue() { + if (tachoValue > tachoValueMax) { + tachoValue = tachoValueMax; + } else if (tachoValue < tachoValueMin) { + tachoValue = tachoValueMin; } } - Image{ - id:rpmGuage + Image { + id: rpmGuage source: "qrc:/Images/NormalView/METER/prm_guage.ktx" - x:770 - y:200 - width:380 - height:382 + x: 770 + y: 200 + width: 380 + height: 382 visible: false } - ShaderEffect{ + ShaderEffect { id: effectRpm anchors.fill: rpmGuage visible: true blending: true supportsAtlasTextures: true - property real angleBase: -pi*3/4 - property real angle:-pi*3/4 - property var src: ShaderEffectSource{ + property real angleBase: -pi * 3 / 4 + property real angle: -pi * 3 / 4 + property var src: ShaderEffectSource { sourceItem: rpmGuage live: false } - readonly property real pi: 3.1415926535 - vertexShader: "qrc:/Shaders/vert/guageMask.vert" - fragmentShader:"qrc:/Shaders/frag/guageMask.frag" + vertexShader: ShaderPath.guageMaskVert + fragmentShader: ShaderPath.guageMaskFrag } - - Image{ - id:rpmTxt + Image { + id: rpmTxt source: "qrc:/Images/NormalView/METER/prm_txt.png" - x:770 - y:190 - width:379 - height:401 + x: 770 + y: 190 + width: 379 + height: 401 } - - SequentialAnimation{ - id:normalToAdasAnimation - onStarted: rootItem.focus=false - PropertyAnimation{ - target:tachometer - property:"opacity" + + SequentialAnimation { + id: normalToAdasAnimation + onStarted: rootItem.focus = false + PropertyAnimation { + target: tachometer + property: "opacity" duration: 330 easing.type: Easing.Linear - to:0 + to: 0 } - PropertyAnimation{ + PropertyAnimation { target: tachometer property: "visible" duration: 0 - to:false + to: false } } - - SequentialAnimation{ - id:mapToNormalAnimation - onStarted: rootItem.focus=false - + + SequentialAnimation { + id: mapToNormalAnimation + onStarted: rootItem.focus = false + PauseAnimation { duration: 891 + 330 + 254 } - - PropertyAnimation{ + + PropertyAnimation { target: tachometer property: "visible" duration: 0 - to:true + to: true } - - PropertyAnimation{ - target:tachometer - property:"opacity" + + PropertyAnimation { + target: tachometer + property: "opacity" duration: 330 easing.type: Easing.Linear - to:1 + to: 1 } } - } |