Warning, /plasma/plasma-desktop/kcms/gamecontroller/ui/PositionWidget.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Controls as QQC2 0009 import QtQuick.Shapes 0010 0011 import org.kde.kirigami as Kirigami 0012 0013 Rectangle { 0014 id: root 0015 0016 implicitWidth: 220 0017 implicitHeight: 220 0018 0019 required property var device 0020 readonly property color lightColor: Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.textColor, 0.2) 0021 0022 readonly property int markWidth: 5 0023 0024 readonly property real axisXValue: device !== null ? device.axisValue.x : 0 0025 readonly property real axisYValue: device !== null ? device.axisValue.y : 0 0026 0027 readonly property real axisX: (axisXValue * root.width / 2) + (root.width / 2) 0028 readonly property real axisY: (axisYValue * root.height / 2) + (root.height / 2) 0029 0030 border { 0031 color: Kirigami.Theme.textColor 0032 width: 1 0033 } 0034 0035 color: "transparent" 0036 0037 Shape { 0038 anchors.fill: parent 0039 0040 // horizontal middle separator 0041 ShapePath { 0042 strokeWidth: 1 0043 strokeColor: root.lightColor 0044 0045 startX: 0 0046 startY: root.height / 2 0047 0048 PathLine { 0049 x: root.width 0050 y: root.height / 2 0051 } 0052 } 0053 0054 // vertical middle separator 0055 ShapePath { 0056 strokeWidth: 1 0057 strokeColor: root.lightColor 0058 0059 startX: root.width / 2 0060 startY: 0 0061 0062 PathLine { 0063 x: root.width / 2 0064 y: root.height 0065 } 0066 } 0067 0068 // first part of the marker 0069 ShapePath { 0070 strokeWidth: 1 0071 strokeColor: Kirigami.Theme.textColor 0072 0073 startX: root.axisX - root.markWidth 0074 startY: root.axisY - root.markWidth 0075 0076 PathLine { 0077 x: root.axisX + root.markWidth 0078 y: root.axisY + root.markWidth 0079 } 0080 } 0081 0082 // second part of the marker 0083 ShapePath { 0084 strokeWidth: 1 0085 strokeColor: Kirigami.Theme.textColor 0086 0087 startX: root.axisX + root.markWidth 0088 startY: root.axisY - root.markWidth 0089 0090 PathLine { 0091 x: root.axisX - root.markWidth 0092 y: root.axisY + root.markWidth 0093 } 0094 } 0095 } 0096 }