summaryrefslogtreecommitdiff
path: root/components/controls/StyledScrollBar.qml
blob: 69a01f3665c84fc2429924ccbd84fc955604971b (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
import ".."
import qs.services
import qs.config
import QtQuick
import QtQuick.Controls

ScrollBar {
    id: root

    contentItem: StyledRect {
        implicitWidth: 6
        opacity: root.pressed ? 1 : root.policy === ScrollBar.AlwaysOn || (root.active && root.size < 1) ? 0.8 : 0
        radius: Appearance.rounding.full
        color: Colours.palette.m3secondary

        Behavior on opacity {
            Anim {}
        }
    }

    CustomMouseArea {
        z: -1
        anchors.fill: parent

        function onWheel(event: WheelEvent): void {
            if (event.angleDelta.y > 0)
                root.decrease();
            else if (event.angleDelta.y < 0)
                root.increase();
        }
    }
}