86 lines
1.7 KiB
QML
86 lines
1.7 KiB
QML
import QtQuick
|
|
import QtQuick.Shapes
|
|
|
|
import Quickshell
|
|
import Quickshell.Widgets
|
|
|
|
MouseArea {
|
|
id: root
|
|
|
|
property real radius: 15
|
|
property real pad: 10
|
|
property color color
|
|
|
|
property Item item
|
|
|
|
hoverEnabled: true
|
|
|
|
Component.onCompleted: {
|
|
|
|
item.y = pad
|
|
}
|
|
|
|
width: shape.width
|
|
height: shape.height
|
|
|
|
Shape {
|
|
id: shape
|
|
|
|
//anchors.centerIn: parent
|
|
ShapePath {
|
|
id: path
|
|
|
|
strokeWidth: 4
|
|
strokeColor: root.color
|
|
fillColor: root.color
|
|
|
|
startX: -radius - pad; startY: 0
|
|
|
|
PathArc {
|
|
radiusX: radius
|
|
radiusY: radius
|
|
|
|
relativeX: radius
|
|
relativeY: radius
|
|
}
|
|
|
|
PathLine { relativeX: 0; relativeY: 2 * pad + item.height - 2 * radius }
|
|
|
|
PathArc {
|
|
radiusX: radius
|
|
radiusY: radius
|
|
|
|
direction: PathArc.Counterclockwise
|
|
|
|
relativeX: radius
|
|
relativeY: radius
|
|
}
|
|
|
|
PathLine { x: item.width + pad - radius; relativeY: 0 }
|
|
|
|
PathArc {
|
|
radiusX: radius
|
|
radiusY: radius
|
|
|
|
direction: PathArc.Counterclockwise
|
|
|
|
relativeX: radius
|
|
relativeY: -radius
|
|
}
|
|
|
|
PathLine { relativeX: 0; relativeY: -item.height + 2 * radius - 2 * pad }
|
|
|
|
PathArc {
|
|
radiusX: radius
|
|
radiusY: radius
|
|
|
|
relativeX: radius
|
|
relativeY: -radius
|
|
}
|
|
|
|
PathLine { x: -radius - pad; y: 0 }
|
|
}
|
|
}
|
|
}
|
|
|