21 import org.kde.kirigami 1.0
41 default property alias page: mainPage.data
47 property Item contentItem
54 property alias opened: sidebar.open
62 property real position: 0
85 property Item background
87 onBackgroundChanged: {
88 background.parent = browserFrame;
89 background.anchors.fill = browserFrame;
93 Component.onCompleted: {
94 mainPage.width = browserFrame.width
95 contentItem.parent = drawerPage
99 if (!browserFrame.loopCheck) {
100 browserFrame.loopCheck =
true;
101 browserFrame.x = position * drawerPage.width;
102 browserFrame.loopCheck =
false;
105 onContentItemChanged: contentItem.parent = drawerPage
107 id: mouseEventListener
109 drag.filterChildren:
true
111 property int startMouseX
112 property int oldMouseX
113 property int startBrowserFrameX
114 property bool toggle:
false
115 property string startState
121 if (drawerPage.children.length == 0 || (browserFrame.state ==
"Closed" && mouse.x >
Units.
gridUnit) ||
122 mouse.x < browserFrame.x) {
123 mouse.accepted =
false;
128 startBrowserFrameX = browserFrame.x;
129 oldMouseX = startMouseX = mouse.x;
130 startState = browserFrame.state;
131 browserFrame.state =
"Dragging";
132 browserFrame.x = startBrowserFrameX;
136 browserFrame.x = Math.max(0, browserFrame.x + mouse.x - oldMouseX);
145 browserFrame.state = startState ==
"Open" ?
"Closed" :
"Open"
146 }
else if (browserFrame.x < drawerPage.width / 2) {
147 browserFrame.state =
"Closed";
149 browserFrame.state =
"Open";
152 onClicked: root.clicked()
158 state: sidebar.open ?
"Open" :
"Closed"
159 onStateChanged: sidebar.open = (state !=
"Closed")
160 readonly property real position: Math.abs(x) / drawerPage.width
161 property bool loopCheck:
false
165 root.position = position;
172 bottom: parent.bottom
178 onChildrenChanged: mainPage.children[0].anchors.fill = mainPage
186 opacity: Math.min(0.4, 0.4 * (browserFrame.x / drawerPage.width))
203 x: mouseEventListener.startBrowserFrameX
218 to:
"Open,Closed,Hidden"
222 easing.type: Easing.InOutQuad
232 property bool open:
false
234 if (drawerPage.children.length == 0) {
239 browserFrame.state =
"Open";
241 browserFrame.state =
"Closed";
245 width: browserFrame.x
251 bottom: parent.bottom
256 width: Math.min(root.width/4*3, Math.max(root.contentItem ? root.contentItem.implicitWidth : 0, root.width/4))
259 bottom: parent.bottom
261 topMargin: (applicationWindow !== undefined && applicationWindow().header) && modal ? applicationWindow().header.height : 0
264 onChildrenChanged: drawerPage.children[0].anchors.fill = drawerPage
int longDuration
units.longDuration should be used for longer, screen-covering animations, for opening and closing of ...
int gridUnit
The fundamental unit of space that should be used for sizes, expressed in pixels. ...