blob: 9f8ffacf85d30f403116da8e4e45119c15edaa68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
import ".."
import qs.services
import qs.config
import QtQuick
import QtQuick.Shapes
Item {
id: root
required property var currentItem
implicitWidth: content.implicitWidth + Appearance.padding.larger + content.anchors.rightMargin
implicitHeight: currentItem ? content.implicitHeight + Appearance.padding.normal + content.anchors.bottomMargin : 0
Shape {
preferredRendererType: Shape.CurveRenderer
ShapePath {
id: path
readonly property real rounding: Appearance.rounding.small
readonly property bool flatten: root.implicitHeight < rounding * 2
readonly property real roundingY: flatten ? root.implicitHeight / 2 : rounding
strokeWidth: -1
fillColor: Colours.tPalette.m3surfaceContainer
startX: root.implicitWidth
startY: root.implicitHeight
PathLine {
relativeX: -(root.implicitWidth + path.rounding)
relativeY: 0
}
PathArc {
relativeX: path.rounding
relativeY: -path.roundingY
radiusX: path.rounding
radiusY: Math.min(path.rounding, root.implicitHeight)
direction: PathArc.Counterclockwise
}
PathLine {
relativeX: 0
relativeY: -(root.implicitHeight - path.roundingY * 2)
}
PathArc {
relativeX: path.rounding
relativeY: -path.roundingY
radiusX: path.rounding
radiusY: Math.min(path.rounding, root.implicitHeight)
}
PathLine {
relativeX: root.implicitHeight > 0 ? root.implicitWidth - path.rounding * 2 : root.implicitWidth
relativeY: 0
}
PathArc {
relativeX: path.rounding
relativeY: -path.rounding
radiusX: path.rounding
radiusY: path.rounding
direction: PathArc.Counterclockwise
}
Behavior on fillColor {
ColorAnimation {
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
}
}
}
Item {
anchors.fill: parent
clip: true
StyledText {
id: content
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.rightMargin: Appearance.padding.larger - Appearance.padding.small
anchors.bottomMargin: Appearance.padding.normal - Appearance.padding.small
text: qsTr(`"%1" selected`).arg(root.currentItem?.fileName)
}
}
Behavior on implicitWidth {
enabled: !!root.currentItem
NumberAnimation {
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
}
Behavior on implicitHeight {
NumberAnimation {
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
}
}
|