aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols/wearable/Wearable/ListHeaderItem.qml
blob: 3cf82ff2111a50889ae6921fcd2f63ebf94f4a7e (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
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Shapes
import QtQuick.Effects
import WearableStyle

Item {
    Rectangle {
        id: listitem
        width: parent.width
        height: parent.height

        radius: 8
        color: UIStyle.listItemBackground

        Shape {
            id: header
            property int ra: parent.radius
            property int h: 28
            property int w: parent.width

            preferredRendererType: Shape.CurveRenderer

            ShapePath { //Shape because Rectangle does not support diagonal gradient
                strokeWidth: 0

                startX: 0
                startY: header.ra

                PathArc {
                    x: header.ra
                    y: 0
                    radiusX: header.ra
                    radiusY: header.ra
                }
                PathLine {
                    x: header.w - header.ra
                    y: 0
                }
                PathArc {
                    x: header.w
                    y: header.ra
                    radiusX: header.ra
                    radiusY: header.ra
                }
                PathLine {
                    x: header.w
                    y: header.h
                }
                PathLine {
                    x: 0
                    y: header.h
                }
                fillGradient: LinearGradient {
                    x1: 0
                    y1: 0
                    x2: 2
                    y2: 1.3 * header.h
                    GradientStop {
                        position: 0.0
                        color: UIStyle.listHeader1
                    }
                    GradientStop {
                        position: 1.0
                        color: UIStyle.listHeader2
                    }
                }
            }
        }
    }

    MultiEffect {
        source: listitem
        anchors.fill: parent
        shadowEnabled: true
        shadowBlur: 0.3
        shadowHorizontalOffset: 2
        shadowVerticalOffset: 2
        opacity: 0.5
    }
}