Kirigami2

ContextIcon.qml
1 /*
2  * SPDX-FileCopyrightText: 2015 Marco Martin <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 import QtQuick 2.1
8 import org.kde.kirigami 2.4 as Kirigami
9 
10 Item {
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 
22  Item {
23  id: iconRoot
24  anchors {
25  fill: parent
26  margins: Kirigami.Units.smallSpacing
27  }
28  property int thickness: 2
29  Rectangle {
30  anchors {
31  horizontalCenter: parent.horizontalCenter
32  top: parent.top
33  //horizontalCenterOffset: -parent.width/2
34  topMargin: (parent.height/2 - iconRoot.thickness/2) * drawer.position
35  }
36  antialiasing: drawer.position !== 0
37  transformOrigin: Item.Center
38  width: (1 - drawer.position) * height + drawer.position * (Math.sqrt(2*(parent.width*parent.width)))
39  height: iconRoot.thickness
40  color: canvas.color
41  rotation: 45 * drawer.position
42  }
43 
44  Rectangle {
45  anchors.centerIn: parent
46  width: height
47  height: iconRoot.thickness
48  color: canvas.color
49  }
50 
51 
52  Rectangle {
53  anchors {
54  horizontalCenter: parent.horizontalCenter
55  bottom: parent.bottom
56  // topMargin: -iconRoot.thickness/2 * drawer.position
57  bottomMargin: (parent.height/2 - iconRoot.thickness/2) * drawer.position
58  }
59  antialiasing: drawer.position !== 0
60  transformOrigin: Item.Center
61  width: (1 - drawer.position) * height + drawer.position * (Math.sqrt(2*(parent.width*parent.width)))
62  height: iconRoot.thickness
63  color: canvas.color
64  rotation: -45 * drawer.position
65  }
66  }
67 }
68 
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Jan 29 2023 04:11:03 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.