Repository navigation
Expand file tree
/
Copy pathStackIcon.qml
More file actions
53 lines (44 loc) · 1.56 KB
/
Copy pathStackIcon.qml
File metadata and controls
53 lines (44 loc) · 1.56 KB
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
import QtQuick
import qs.Commons
// Three plates seen edge-on, the top one offset: things put away in a pile,
// with the top one ready to come off. Drawn as solid bars rather than an
// outlined glyph because the bar renders this near 12px, where outlines fill in.
Item {
id: root
property real iconSize: Style.font.icon
property color color: Color.foreground
// Unfolded, the pile leans open — the same three plates, fanned.
property bool open: false
width: iconSize
height: iconSize
implicitWidth: iconSize
implicitHeight: iconSize
readonly property real plateHeight: Math.max(1, Math.round(iconSize * 0.14))
readonly property real plateWidth: iconSize * 0.78
readonly property real gap: Math.max(1, Math.round(iconSize * 0.16))
Item {
id: stack
width: parent.width
height: root.plateHeight * 3 + root.gap * 2
anchors.centerIn: parent
Repeater {
model: 3
Rectangle {
required property int index
width: root.plateWidth
height: root.plateHeight
radius: height / 2
color: root.color
antialiasing: true
// The top plate slides aside when the stack is open, the bottom two
// stay put: the pile is being taken off, not rearranged.
x: (stack.width - width) / 2 + (root.open && index === 0 ? root.iconSize * 0.16 : 0)
y: index * (root.plateHeight + root.gap)
opacity: index === 0 ? 1.0 : (index === 1 ? 0.8 : 0.6)
Behavior on x {
NumberAnimation { duration: 140; easing.type: Easing.OutCubic }
}
}
}
}
}