Warning, /libraries/kirigami-addons/src/dateandtime/ClockFace.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2019 David Edmundson <davidedmundson@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.0 0008 import org.kde.ksvg 1.0 as KSvg 0009 import "private" 0010 0011 Item { 0012 id: clock 0013 property date time 0014 property bool showSecondsHand: false 0015 0016 property int _hours 0017 property int _minutes 0018 property int _seconds 0019 0020 onTimeChanged: { 0021 _hours = time.getHours(); 0022 _minutes = time.getMinutes(); 0023 _seconds = time.getSeconds(); 0024 } 0025 0026 KSvg.Svg { 0027 id: clockSvg 0028 imagePath: "widgets/clock" 0029 } 0030 0031 KSvg.SvgItem { 0032 id: face 0033 anchors.centerIn: parent 0034 width: Math.min(parent.width, parent.height) 0035 height: Math.min(parent.width, parent.height) 0036 svg: clockSvg 0037 elementId: "ClockFace" 0038 } 0039 0040 Hand { 0041 anchors.topMargin: 3 0042 elementId: "HourHandShdow" 0043 rotation: 180 + _hours * 30 + (_minutes/2) 0044 svgScale: face.width / face.naturalSize.width 0045 0046 } 0047 Hand { 0048 elementId: "HourHand" 0049 rotation: 180 + _hours * 30 + (_minutes/2) 0050 svgScale: face.width / face.naturalSize.width 0051 } 0052 0053 Hand { 0054 anchors.topMargin: 3 0055 elementId: "MinuteHandShadow" 0056 rotation: 180 + _minutes * 6 0057 svgScale: face.width / face.naturalSize.width 0058 } 0059 Hand { 0060 elementId: "MinuteHand" 0061 rotation: 180 + _minutes * 6 0062 svgScale: face.width / face.naturalSize.width 0063 } 0064 0065 Hand { 0066 anchors.topMargin: 3 0067 elementId: "SecondHandShadow" 0068 rotation: 180 + _seconds * 6 0069 visible: showSecondsHand 0070 svgScale: face.width / face.naturalSize.width 0071 } 0072 Hand { 0073 elementId: "SecondHand" 0074 rotation: 180 + _seconds * 6 0075 visible: showSecondsHand 0076 svgScale: face.width / face.naturalSize.width 0077 } 0078 0079 KSvg.SvgItem { 0080 id: center 0081 width: naturalSize.width * face.width / face.naturalSize.width 0082 height: naturalSize.height * face.width / face.naturalSize.width 0083 anchors.centerIn: clock 0084 svg: clockSvg 0085 elementId: "HandCenterScrew" 0086 z: 1000 0087 } 0088 0089 KSvg.SvgItem { 0090 anchors.fill: face 0091 svg: clockSvg 0092 elementId: "Glass" 0093 width: naturalSize.width * face.width / face.naturalSize.width 0094 height: naturalSize.height * face.width / face.naturalSize.width 0095 } 0096 }