C 语言
Qt Quick Ultralite 手表演示
/****************************************************************************** ** ** Copyright (C) 2023 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** 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 http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/import QtQuick 2.15 import QtQuickUltralite.Extras 2.0 import QtQuick.Shapes 2.15 Shape { id: root property bool flip: false property real extent: 0.8 visible: extent > 0 // angles and radii deduced from small-oval-alt.png image property real angle: 225 - 90 * extent property real innerRadius: 123 property real outerRadius: 130 transform: Scale { origin.x: root.width / 2 xScale: flip ? -1 : 1 } function xAt(angle: real, radius: real): real { return root.width / 2 + radius * Math.cos(angle * Math.PI / 180) } function yAt(angle: real, radius: real): real { return root.height / 2 - radius * Math.sin(angle * Math.PI / 180) } ShapePath { fillGradient: LinearGradient { y1: 480 - 90 y2: 90 GradientStop { position: 0.0; color: flip ? "#ff002b" : "#f406f9" } GradientStop { position: 0.5; color: flip ? "#76fd01" : "#00a5ff" } GradientStop { position: 0.6; color: flip ? "#76fd01" : "#00a5ff" } GradientStop { position: 1.0; color: flip ? "#b6fe71" : "#77cfff" } } strokeColor: "transparent" startX: xAt(225, outerRadius) startY: yAt(225, outerRadius) PathArc { x: xAt(angle, outerRadius) y: yAt(angle, outerRadius) radiusX: outerRadius radiusY: outerRadius } PathLine { x: xAt(angle, innerRadius) y: yAt(angle, innerRadius) } PathArc { x: xAt(225, innerRadius) y: yAt(225, innerRadius) radiusX: innerRadius radiusY: innerRadius direction: PathArc.Counterclockwise } } }