Warning, /plasma/plasma-sdk/themeexplorer/package/contents/ui/delegates/analog_meter.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2012 Viranch Mehta <viranch.mehta@gmail.com>
0003  *   SPDX-FileCopyrightText: 2012 Marco Martin <mart@kde.org>
0004  *   SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org>
0005  *
0006  *   SPDX-License-Identifier: LGPL-2.0-or-later
0007  */
0008 
0009 import QtQuick 2.0
0010 import QtQuick.Layouts 1.1
0011 
0012 import org.kde.ksvg 1.0 as KSvg
0013 import org.kde.plasma.components 3.0 as PlasmaComponents
0014 
0015 Item {
0016 
0017     property int value: 30
0018 
0019     KSvg.SvgItem {
0020         id: face
0021         anchors.centerIn: parent
0022         width: Math.min(parent.width, parent.height)
0023         height: width / (naturalSize.width / naturalSize.height)
0024         imagePath: "widgets/analog_meter"
0025         elementId: "background"
0026     }
0027 
0028     KSvg.SvgItem {
0029         id: centerScrew
0030         imagePath: "widgets/analog_meter"
0031         elementId: "rotatecenter"
0032         rotation: value + 90
0033 
0034         x: face.x + meterSvg.elementRect("rotatecenter").x * svgScale
0035         y: face.y + meterSvg.elementRect("rotatecenter").y * svgScale
0036 
0037         property real svgScale: face.width / face.naturalSize.width
0038         width: naturalSize.width * svgScale
0039         height: naturalSize.height * svgScale
0040 
0041         KSvg.SvgItem {
0042             imagePath: "widgets/analog_meter"
0043 
0044             anchors.horizontalCenter: parent.horizontalCenter
0045             y: x
0046             elementId: "pointer-shadow"
0047             width: naturalSize.width * centerScrew.svgScale
0048             height: naturalSize.height * centerScrew.svgScale
0049         }
0050         KSvg.SvgItem {
0051             id: hand
0052             imagePath: "widgets/analog_meter"
0053             elementId: "pointer"
0054             anchors.horizontalCenter: parent.horizontalCenter
0055             y: x
0056 
0057             width: naturalSize.width * centerScrew.svgScale
0058             height: naturalSize.height * centerScrew.svgScale
0059         }
0060     }
0061     KSvg.SvgItem {
0062         imagePath: "widgets/analog_meter"
0063         elementId: "foreground"
0064         anchors.centerIn: centerScrew
0065 
0066         width: naturalSize.width * centerScrew.svgScale
0067         height: naturalSize.height * centerScrew.svgScale
0068     }
0069     PlasmaComponents.Label {
0070         anchors {
0071             horizontalCenter: parent.horizontalCenter
0072             top: face.bottom
0073         }
0074         text: model.imagePath
0075         visible: width < parent.width
0076     }
0077 
0078 }