C
Qt Cluster: Rendering and Recovery from Main UI Failure
// Copyright (C) 2016 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR QTAS OR GPL-3.0-only
// This file is part of the Qt Safe Renderer module
import QtQuick
import ClusterDemo
Item {
id: carinfoContainer
property int total: ValueSource.totalDistance
property int sinceLast: ValueSource.kmSinceCharge
opacity: 0.5
property alias xTarget: startupAnimation.to
property int defaultXPos: 1350
Image {
id: image
source: "image://etc/CarInfoIcon.png"
}
Row {
scale: 0.75
spacing: 14
anchors.top: image.bottom
anchors.horizontalCenter: image.horizontalCenter
CarInfoField {
title: "Total distance"
value: carinfoContainer.total.toString()
unit: "km"
}
CarInfoField {
title: "Since last charge"
value: carinfoContainer.sinceLast.toString()
unit: "km"
}
}
Timer {
id: fadeOutTimer
interval: 5000
running: false
repeat: false
onTriggered: {
carinfoContainer.opacity = 0.5
}
}
Behavior on opacity { PropertyAnimation { duration: 500 } }
PropertyAnimation on x {
id: startupAnimation
duration: 500
easing.type: Easing.InCubic
onStopped: {
carinfoContainer.opacity = 1.0
fadeOutTimer.start()
}
}
onVisibleChanged: {
if (visible) {
x = defaultXPos
startupAnimation.start()
}
}
}