• Skip to content
  • Skip to link menu
Brand

API Documentation

  1. KDE API Reference
  2. Kirigami
  • KDE Home
  • Contact Us

Quick Links

Skip menu "Kirigami"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Related Pages

Class Picker

About

QtQuick plugins to build user interfaces based on the KDE UX guidelines

Maintainer
Marco Martin
Supported platforms
Android, Linux
Community
IRC: #plasma on Freenode
Mailing list: plasma-devel
Use with CMake
find_package(KF5Kirigami)
target_link_libraries(yourapp KF5::Kirigami)
Clone
git clone git://anongit.kde.org/kirigami1.git
Browse source
Kirigami on cgit.kde.org

Kirigami

  • src
  • styles
  • Desktop
styles/Desktop/OverlayDrawer.qml
1 /*
2  * Copyright 2016 Marco Martin <mart@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Library General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 import QtQuick 2.1
21 import org.kde.kirigami 1.0
22 
23 import "../../templates" as T
24 
33 T.OverlayDrawer {
34  id: root
35 
36 //BEGIN Properties
37  background: Rectangle {
38  color: Theme.viewBackgroundColor
39  property Item handleBackground: Item {
40  }
41 
42  Item {
43  id: drawerHandle
44  z: -1
45 
46  anchors {
47  right: root.edge == Qt.LeftEdge ? undefined : parent.left
48  left: root.edge == Qt.RightEdge ? undefined : parent.right
49  bottom: parent.bottom
50  }
51  visible: root.enabled && (root.edge == Qt.LeftEdge || root.edge == Qt.RightEdge)
52  width: Units.iconSizes.medium + Units.smallSpacing * 2
53  height: width
54  opacity: root.handleVisible ? 1 : 0
55  Behavior on opacity {
56  NumberAnimation {
57  duration: Units.longDuration
58  easing.type: Easing.InOutQuad
59  }
60  }
61  transform: Translate {
62  id: translateTransform
63  x: root.handleVisible ? 0 : (root.edge == Qt.LeftEdge ? -drawerHandle.width : drawerHandle.width)
64  Behavior on x {
65  NumberAnimation {
66  duration: Units.longDuration
67  easing.type: !root.handleVisible ? Easing.OutQuad : Easing.InQuad
68  }
69  }
70  }
71  Rectangle {
72  id: handleGraphics
73  color: Theme.viewBackgroundColor
74  opacity: 0.3 + root.position
75  anchors.fill: parent
76  }
77 
78  Loader {
79  anchors.centerIn: handleGraphics
80  width: height
81  height: Units.iconSizes.smallMedium
82  source: root.edge == Qt.LeftEdge ? Qt.resolvedUrl("../../templates/private/MenuIcon.qml") : (root.edge == Qt.RightEdge ? Qt.resolvedUrl("../../templates/private/ContextIcon.qml") : "")
83  onItemChanged: {
84  if(item) {
85  item.morph = Qt.binding(function(){return root.position})
86  }
87  }
88  }
89  Rectangle {
90  anchors {
91  left: parent.left
92  right: parent.right
93  top: parent.top
94  }
95  color: Theme.textColor
96  opacity: 0.3
97  height: Units.devicePixelRatio
98  }
99  Rectangle {
100  anchors {
101  left: root.edge == Qt.LeftEdge ? parent.right : undefined
102  right: root.edge == Qt.RightEdge ? parent.left : undefined
103  top: parent.top
104  bottom: parent.bottom
105  }
106  color: Theme.textColor
107  opacity: 0.3
108  width: Units.devicePixelRatio
109  }
110  }
111 
112  Rectangle {
113  z: -2
114  anchors {
115  right: root.edge == Qt.RightEdge ? parent.left : (root.edge == Qt.LeftEdge ? undefined : parent.right)
116  left: root.edge == Qt.LeftEdge ? parent.right : (root.edge == Qt.RightEdge ? undefined : parent.left)
117  top: root.edge == Qt.TopEdge ? parent.bottom : (root.edge == Qt.BottomEdge ? undefined : parent.top)
118  bottom: root.edge == Qt.BottomEdge ? parent.top : (root.edge == Qt.TopEdge ? undefined : parent.bottom)
119  }
120  color: Theme.textColor
121  opacity: root.position == 0 ? 0 : 0.3
122  width: Units.devicePixelRatio
123  }
124  }
125 
126  //default to a sidebar in desktop mode
127  modal: edge == Qt.TopEdge || edge == Qt.BottomEdge
128  opened: true
129 }
org::kde::kirigami::Units::smallSpacing
int smallSpacing
units.smallSpacing is the amount of spacing that should be used around smaller UI elements...
Definition: controls/Units.qml:56
org::kde::kirigami::Units::devicePixelRatio
real devicePixelRatio
The ratio between physical and device-independent pixels.
Definition: controls/Units.qml:70
org::kde::kirigami::Units::longDuration
int longDuration
units.longDuration should be used for longer, screen-covering animations, for opening and closing of ...
Definition: controls/Units.qml:75
org::kde::kirigami::Theme
Definition: controls/Theme.qml:22
org::kde::kirigami::Units
Definition: controls/Units.qml:24
org::kde::kirigami::Units::iconSizes
QtObject iconSizes
units.iconSizes provides access to platform-dependent icon sizing
Definition: controls/Units.qml:49
This file is part of the KDE documentation.
Documentation copyright © 1996-2017 The KDE developers.
Generated on Fri Feb 17 2017 11:09:23 by doxygen 1.8.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal