Kirigami2

EdgeShadow.qml
1/*
2 * SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7import QtQuick
8import org.kde.kirigami as Kirigami
9
10Item {
11 id: shadow
12 /**
13 * @brief This property holds the edge of the shadow that will determine the direction of the gradient.
14 * The acceptable values are:
15 * * ``Qt.TopEdge``: the top edge of the content item.
16 * * ``Qt.LeftEdge``: the left edge of the content item
17 * * ``Qt.RightEdge``: the right edge of the content item.
18 * * ``Qt.BottomEdge``: the bottom edge of the content item.
19 *
20 * @see Qt::Edges
21 */
22 property int edge: Qt.LeftEdge
23
24 property int radius: Kirigami.Units.cornerRadius
25 implicitWidth: radius
26 implicitHeight: radius
27
28 Rectangle {
29 x: shadow.width / 2 - width / 2
30 y: shadow.height / 2 - height / 2
31 width: (shadow.edge === Qt.LeftEdge || shadow.edge === Qt.RightEdge) ? shadow.height : shadow.width
32 height: (shadow.edge === Qt.LeftEdge || shadow.edge === Qt.RightEdge) ? shadow.width : shadow.height
33 rotation: {
34 switch (shadow.edge) {
35 case Qt.TopEdge: return 0;
36 case Qt.LeftEdge: return 270;
37 case Qt.RightEdge: return 90;
38 case Qt.BottomEdge: return 180;
39 }
40 }
41
42 gradient: Gradient {
43 GradientStop {
44 position: 0.0
45 color: Qt.rgba(0, 0, 0, 0.25)
46 }
47 GradientStop {
48 position: 0.20
49 color: Qt.rgba(0, 0, 0, 0.1)
50 }
51 GradientStop {
52 position: 0.35
53 color: Qt.rgba(0, 0, 0, 0.02)
54 }
55 GradientStop {
56 position: 1.0
57 color: "transparent"
58 }
59 }
60 }
61}
62
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:20 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.