-
Notifications
You must be signed in to change notification settings - Fork 13
/
ScrollBar.qml
34 lines (30 loc) · 901 Bytes
/
ScrollBar.qml
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
import QtQuick 2.0;
Item {
id: scrollbar;
width: 5;
visible: (flickable.visibleArea.heightRatio < 1.0);
anchors {
top: flickable.top;
right: flickable.right;
bottom: flickable.bottom;
margins: 1;
}
property Flickable flickable: null;
Binding {
target: handle;
property: "y";
value: (flickable.contentY * (scrollbar.height - handle.height) / (flickable.contentHeight - flickable.height));
}
Rectangle {
id: handle;
height: Math.max (20, (flickable.visibleArea.heightRatio * scrollbar.height));
color: "white";
radius: 32;
opacity: (flickable.moving ? 0.65 : 0);
anchors {
left: parent.left;
right: parent.right;
}
Behavior on opacity { NumberAnimation { duration: 150; } }
}
}