Kirigami2

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