MauiKit Controls

WindowResizeHandlers.qml
1/*
2 * Copyright 2018 Camilo Higuita <milo.h@aol.com>
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 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
20import QtQuick
21
22import QtQuick.Window
23import QtQuick.Controls
24
25Item
26{
27 id: control
28 Loader
29 {
30 active: canResizeH
31 asynchronous: true
32 visible: active
33 height: parent.height
34 width: 6
35 anchors.right: parent.right
36
37 sourceComponent: Item
38 {
39 MouseArea
40 {
41 anchors.fill: parent
42 cursorShape: Qt.SizeHorCursor
43 acceptedButtons: Qt.NoButton // don't handle actual events
44 }
45
46 DragHandler
47 {
48 grabPermissions: TapHandler.TakeOverForbidden
49 target: null
50 onActiveChanged:
51 {
52 if (active)
53 {
54 control.Window.window.startSystemResize(Qt.RightEdge)
55 }
56 }
57 }
58 }
59 }
60
61 Loader
62 {
63 active: canResizeH
64
65 asynchronous: true
66 visible: active
67 height: parent.height
68 width: 6
69 anchors.left: parent.left
70
71 sourceComponent: Item
72 {
73 MouseArea
74 {
75 anchors.fill: parent
76 cursorShape: Qt.SizeHorCursor
77 acceptedButtons: Qt.NoButton // don't handle actual events
78 }
79
80 DragHandler
81 {
82 grabPermissions: TapHandler.TakeOverForbidden
83 target: null
84 onActiveChanged:
85 {
86 if (active)
87 {
88 control.Window.window.startSystemResize(Qt.LeftEdge)
89 }
90 }
91 }
92 }
93 }
94
95 Loader
96 {
97 active: canResizeV
98
99 asynchronous: true
100 visible: active
101 height: 6
102 width: parent.width
103 anchors.bottom: parent.bottom
104
105 sourceComponent: Item
106 {
107 MouseArea
108 {
109 anchors.fill: parent
110 cursorShape: Qt.SizeVerCursor
111 acceptedButtons: Qt.NoButton // don't handle actual events
112 }
113
114 DragHandler
115 {
116 grabPermissions: TapHandler.TakeOverForbidden
117 target: null
118 onActiveChanged:
119 {
120 if (active)
121 {
122 control.Window.window.startSystemResize(Qt.BottomEdge)
123 }
124 }
125 }
126 }
127 }
128
129
130 Loader
131 {
132 active: canResizeV || canResizeH
133
134 asynchronous: true
135 visible: active
136 height: 16
137 width: height
138 anchors.bottom: parent.bottom
139 anchors.left: parent.left
140
141 sourceComponent: Item
142 {
143 MouseArea
144 {
145 anchors.fill: parent
146 cursorShape: Qt.SizeBDiagCursor
147 acceptedButtons: Qt.NoButton // don't handle actual events
148 }
149
150 DragHandler
151 {
152 grabPermissions: TapHandler.TakeOverForbidden
153 target: null
154 onActiveChanged:
155 {
156 if (active)
157 {
158 control.Window.window.startSystemResize(Qt.LeftEdge | Qt.BottomEdge);
159 }
160 }
161 }
162 }
163 }
164
165 Loader
166 {
167 asynchronous: true
168 visible: active
169 height: 16
170 width: height
171 anchors.bottom: parent.bottom
172 anchors.right: parent.right
173
174 sourceComponent: Item
175 {
176 MouseArea
177 {
178 anchors.fill: parent
179 cursorShape: Qt.SizeFDiagCursor
180 acceptedButtons: Qt.NoButton // don't handle actual events
181 }
182
183 DragHandler
184 {
185 grabPermissions: TapHandler.TakeOverForbidden
186 target: null
187 onActiveChanged:
188 {
189 if (active)
190 {
191 control.Window.window.startSystemResize(Qt.RightEdge | Qt.BottomEdge)
192 }
193 }
194 }
195 }
196 }
197
198}
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 25 2025 11:53:32 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.