blob: 63b2555d97a9acc5b1116cd5dcec2b78bea060d2 (
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
|
import QtQuick
import QtQuick.Controls.impl
import QtQuick.Templates as T
T.ScrollBar {
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
visible: control.policy !== T.ScrollBar.AlwaysOff
minimumSize: orientation === Qt.Horizontal ? height / width : width / height
topPadding: (horizontal ? __config.topPadding : __config.leftPadding) || 0
leftPadding: (horizontal ? __config.leftPadding : __config.bottomPadding) || 0
rightPadding: (horizontal ? __config.rightPadding : __config.topPadding) || 0
bottomPadding: (horizontal ? __config.bottomPadding : __config.rightPadding) || 0
topInset: (horizontal ? -__config.topInset : -__config.leftInset) || 0
leftInset: (horizontal ? -__config.leftInset : -__config.bottomInset) || 0
rightInset: (horizontal ? -__config.rightInset : -__config.topInset) || 0
bottomInset: (horizontal ? -__config.bottomInset : -__config.rightInset) || 0
readonly property string __currentState: [
!control.enabled && "disabled",
control.enabled && !control.pressed && control.hovered && "hovered",
control.pressed && "pressed"
].filter(Boolean).join("_") || "normal"
readonly property var __config: Config.controls.scrollbar[__currentState] || {}
contentItem: StyleImage {
imageConfig: control.__config.handle
horizontal: control.horizontal
width: control.availableWidth
height: control.availableHeight
opacity: 0.0
}
background: StyleImage {
imageConfig: control.__config.background
horizontal: control.horizontal
opacity: 0.0
}
states: [
State {
name: "active"
when: control.policy === T.ScrollBar.AlwaysOn || (control.active && control.size < 1.0)
}
]
transitions: [
// TODO: Set transition settings based on Figma prototype
Transition {
to: "active"
NumberAnimation { targets: [control.contentItem, control.background]; property: "opacity"; to: 1.0 }
},
Transition {
from: "active"
SequentialAnimation {
PropertyAction{ targets: [control.contentItem, control.background]; property: "opacity"; value: 1.0 }
PauseAnimation { duration: 3000 }
NumberAnimation { targets: [control.contentItem, control.background]; property: "opacity"; to: 0.0 }
}
}
]
}
|