Warning, /utilities/filelight/src/qml/SegmentShape.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0002 // SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
0003
0004 import QtQuick 2.15
0005 import QtQuick.Layouts 1.15
0006 import QtQuick.Controls 2.15 as QQC2
0007 import org.kde.kirigami 2.19 as Kirigami
0008 import org.kde.coreaddons 1.0 as KCoreAddons
0009 import QtQuick.Shapes 1.15
0010
0011 import org.kde.filelight 1.0
0012
0013 // Different from CenterShape because this lines rather than moving from center. This produces consistent strokes
0014 // on all edges.
0015 // NOTE: keep this file in sync with CenterShape.qml!
0016 Shape {
0017 id: shape
0018
0019 required property Segment segment
0020
0021 property alias item: path.item
0022 property alias radius: path.radius
0023 property alias startAngle: path.startAngle
0024 property alias sweepAngle: path.sweepAngle
0025
0026 property alias tooltipText: tooltip.text
0027 property alias showTooltip: tooltip.visible
0028
0029 property alias fillColor: path.fillColor
0030
0031 property string segmentUuid: segment.uuid
0032 property url url: segment.url()
0033
0034 containsMode: Shape.FillContains
0035
0036 QQC2.ToolTip {
0037 id: tooltip
0038 delay: 0
0039 parent: shape
0040 x: mouseyX + Kirigami.Units.gridUnit // offset away from mouse lest it covers the tooltip
0041 y: mouseyY + Kirigami.Units.gridUnit
0042 visible: showTooltip
0043 }
0044
0045 ShapePath {
0046 id: path
0047 property var item: shape.item
0048 property var radius: shape.radius
0049 required property var startAngle
0050 required property var sweepAngle
0051
0052 strokeColor: Kirigami.Theme.textColor
0053 strokeWidth: Kirigami.Units.smallSpacing / 4
0054 capStyle: ShapePath.FlatCap
0055
0056 startX: item.width / 2
0057 startY: item.height / 2
0058
0059 PathAngleArc {
0060 id: arc
0061 moveToStart: false // draw line from startX/Y to start of arc
0062 centerX: item.width / 2
0063 centerY: item.height / 2
0064 // minus strokewidth so it doesn't overlap the edge for the outer most segements
0065 radiusX: path.radius - path.strokeWidth
0066 radiusY: radiusX
0067 startAngle: path.startAngle
0068 sweepAngle: path.sweepAngle
0069 }
0070
0071 PathLine { // draw line from end of arc to center again
0072 x: item.width / 2
0073 y: item.height / 2
0074 }
0075 }
0076 }