C
Qt Cluster: Rendering and Recovery from Main UI Failure
// Copyright (C) 2023 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause // This file is part of the Qt Safe Renderer module import QtQuick import ".." import ClusterDemo Flipable { id: flipable height: width property bool flipped: false signal loaded property alias flipRotation: flipRotation property alias rpm: rpm property int rpmValue: 4000 front: Loader { id: rpm width: parent.width height: parent.width asynchronous: true source: "RPMGauge_painter.qml" onLoaded: flipable.loaded() } back: Loader { width: parent.width height: parent.width asynchronous: true source: "../CarParkingSports.qml" } transform: Rotation { id: flipRotation origin.x: flipable.width / 2 origin.y: flipable.height / 2 axis.x: 0; axis.y: 1; axis.z: 0 // set axis.y to 1 to rotate around y-axis angle: 90 // the default angle } states: [ State { name: "back" PropertyChanges { target: flipRotation angle: 180 } PropertyChanges { target: flipable.front visible: false } PropertyChanges { target: flipable.back visible: true } when: flipable.flipped }, State { name: "front" PropertyChanges { target: flipRotation angle: 0 } PropertyChanges { target: flipable.front visible: true } PropertyChanges { target: flipable.back visible: false } when: !flipable.flipped } ] transitions: Transition { NumberAnimation { target: flipRotation; property: "angle"; duration: 300 } } //Fill background while flipping. TODO think better way to do it Rectangle { anchors.centerIn: parent radius: flipable.width+4 /2 width: flipable.width+4 height: flipable.width+4 color: "black" z: -1 } }