Kirigami2

ContextIcon.qml
1/*
2 * SPDX-FileCopyrightText: 2015 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: canvas
12
13 property Kirigami.OverlayDrawer drawer
14 property color color: Kirigami.Theme.textColor
15 property int thickness: 2
16
17 property real position: drawer?.position ?? 0
18
19 width: Kirigami.Units.iconSizes.smallMedium
20 height: Kirigami.Units.iconSizes.smallMedium
21 opacity: 0.8
22 layer.enabled: true
23
24 LayoutMirroring.enabled: false
25 LayoutMirroring.childrenInherit: true
26
27 Item {
28 id: iconRoot
29 anchors {
30 fill: parent
31 margins: Kirigami.Units.smallSpacing
32 }
33 Rectangle {
34 anchors {
35 horizontalCenter: parent.horizontalCenter
36 top: parent.top
37 topMargin: (parent.height / 2 - canvas.thickness / 2) * canvas.position
38 }
39 antialiasing: canvas.position !== 0
40 transformOrigin: Item.Center
41 width: (1 - canvas.position) * height + canvas.position * Math.sqrt(2 * parent.width * parent.width)
42 height: canvas.thickness
43 color: canvas.color
44 rotation: 45 * canvas.position
45 }
46
47 Rectangle {
48 anchors.centerIn: parent
49 width: height
50 height: canvas.thickness
51 color: canvas.color
52 }
53
54 Rectangle {
55 anchors {
56 horizontalCenter: parent.horizontalCenter
57 bottom: parent.bottom
58 bottomMargin: (parent.height / 2 - canvas.thickness / 2) * canvas.position
59 }
60 antialiasing: canvas.position !== 0
61 transformOrigin: Item.Center
62 width: (1 - canvas.position) * height + canvas.position * Math.sqrt(2 * parent.width * parent.width)
63 height: canvas.thickness
64 color: canvas.color
65 rotation: -45 * canvas.position
66 }
67 }
68}
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.