1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtWidgets module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include <QtGui/qevent.h> |
41 | #include <QtGui/qtguiglobal.h> |
42 | |
43 | #include "private/qguiapplication_p.h" |
44 | |
45 | QT_BEGIN_NAMESPACE |
46 | |
47 | QEvent *QGuiApplicationPrivate::cloneEvent(QEvent *e) |
48 | { |
49 | switch (e->type()) { |
50 | case QEvent::MouseButtonPress: |
51 | case QEvent::MouseButtonRelease: |
52 | case QEvent::MouseButtonDblClick: |
53 | case QEvent::MouseMove: |
54 | return new QMouseEvent(*static_cast<QMouseEvent*>(e)); |
55 | case QEvent::KeyPress: |
56 | case QEvent::KeyRelease: |
57 | return new QKeyEvent(*static_cast<QKeyEvent*>(e)); |
58 | case QEvent::FocusIn: |
59 | case QEvent::FocusOut: |
60 | return new QFocusEvent(*static_cast<QFocusEvent*>(e)); |
61 | case QEvent::Enter: |
62 | return new QEvent(*e); |
63 | case QEvent::Leave: |
64 | return new QEvent(*e); |
65 | case QEvent::Paint: |
66 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
67 | break; |
68 | case QEvent::Move: |
69 | return new QMoveEvent(*static_cast<QMoveEvent*>(e)); |
70 | case QEvent::Resize: |
71 | return new QResizeEvent(*static_cast<QResizeEvent*>(e)); |
72 | case QEvent::Create: |
73 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
74 | break; |
75 | case QEvent::Destroy: |
76 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
77 | break; |
78 | case QEvent::Show: |
79 | return new QShowEvent(*static_cast<QShowEvent*>(e)); |
80 | case QEvent::Hide: |
81 | return new QHideEvent(*static_cast<QHideEvent*>(e)); |
82 | case QEvent::Close: |
83 | return new QCloseEvent(*static_cast<QCloseEvent*>(e)); |
84 | case QEvent::Quit: |
85 | return new QEvent(*e); |
86 | case QEvent::ParentChange: |
87 | return new QEvent(*e); |
88 | case QEvent::ParentAboutToChange: |
89 | return new QEvent(*e); |
90 | case QEvent::ThreadChange: |
91 | return new QEvent(*e); |
92 | |
93 | case QEvent::WindowActivate: |
94 | case QEvent::WindowDeactivate: |
95 | return new QEvent(*e); |
96 | |
97 | case QEvent::ShowToParent: |
98 | return new QEvent(*e); |
99 | case QEvent::HideToParent: |
100 | return new QEvent(*e); |
101 | #if QT_CONFIG(wheelevent) |
102 | case QEvent::Wheel: |
103 | return new QWheelEvent(*static_cast<QWheelEvent*>(e)); |
104 | #endif // QT_CONFIG(wheelevent) |
105 | case QEvent::WindowTitleChange: |
106 | return new QEvent(*e); |
107 | case QEvent::WindowIconChange: |
108 | return new QEvent(*e); |
109 | case QEvent::ApplicationWindowIconChange: |
110 | return new QEvent(*e); |
111 | case QEvent::ApplicationFontChange: |
112 | return new QEvent(*e); |
113 | case QEvent::ApplicationLayoutDirectionChange: |
114 | return new QEvent(*e); |
115 | case QEvent::ApplicationPaletteChange: |
116 | return new QEvent(*e); |
117 | case QEvent::PaletteChange: |
118 | return new QEvent(*e); |
119 | case QEvent::Clipboard: |
120 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
121 | break; |
122 | case QEvent::Speech: |
123 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
124 | break; |
125 | case QEvent::MetaCall: |
126 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
127 | break; |
128 | case QEvent::SockAct: |
129 | return new QEvent(*e); |
130 | case QEvent::WinEventAct: |
131 | return new QEvent(*e); |
132 | case QEvent::DeferredDelete: |
133 | return new QEvent(*e); |
134 | #if QT_CONFIG(draganddrop) |
135 | case QEvent::DragEnter: |
136 | return new QDragEnterEvent(*static_cast<QDragEnterEvent*>(e)); |
137 | case QEvent::DragMove: |
138 | return new QDragMoveEvent(*static_cast<QDragMoveEvent*>(e)); |
139 | case QEvent::DragLeave: |
140 | return new QDragLeaveEvent(*static_cast<QDragLeaveEvent*>(e)); |
141 | case QEvent::Drop: |
142 | return new QDropEvent(*static_cast<QDragMoveEvent*>(e)); |
143 | #endif |
144 | case QEvent::ChildAdded: |
145 | return new QChildEvent(*static_cast<QChildEvent*>(e)); |
146 | case QEvent::ChildPolished: |
147 | return new QChildEvent(*static_cast<QChildEvent*>(e)); |
148 | case QEvent::ChildRemoved: |
149 | return new QChildEvent(*static_cast<QChildEvent*>(e)); |
150 | case QEvent::ShowWindowRequest: |
151 | return new QEvent(*e); |
152 | case QEvent::PolishRequest: |
153 | return new QEvent(*e); |
154 | case QEvent::Polish: |
155 | return new QEvent(*e); |
156 | case QEvent::LayoutRequest: |
157 | return new QEvent(*e); |
158 | case QEvent::UpdateRequest: |
159 | return new QEvent(*e); |
160 | case QEvent::UpdateLater: |
161 | return new QEvent(*e); |
162 | |
163 | case QEvent::EmbeddingControl: |
164 | return new QEvent(*e); |
165 | case QEvent::ActivateControl: |
166 | return new QEvent(*e); |
167 | case QEvent::DeactivateControl: |
168 | return new QEvent(*e); |
169 | |
170 | #ifndef QT_NO_CONTEXTMENU |
171 | case QEvent::ContextMenu: |
172 | return new QContextMenuEvent(*static_cast<QContextMenuEvent*>(e)); |
173 | #endif |
174 | case QEvent::InputMethod: |
175 | return new QInputMethodEvent(*static_cast<QInputMethodEvent*>(e)); |
176 | case QEvent::LocaleChange: |
177 | return new QEvent(*e); |
178 | case QEvent::LanguageChange: |
179 | return new QEvent(*e); |
180 | case QEvent::LayoutDirectionChange: |
181 | return new QEvent(*e); |
182 | case QEvent::Style: |
183 | return new QEvent(*e); |
184 | #if QT_CONFIG(tabletevent) |
185 | case QEvent::TabletMove: |
186 | case QEvent::TabletPress: |
187 | case QEvent::TabletRelease: |
188 | return new QTabletEvent(*static_cast<QTabletEvent*>(e)); |
189 | #endif // QT_CONFIG(tabletevent) |
190 | case QEvent::OkRequest: |
191 | return new QEvent(*e); |
192 | case QEvent::HelpRequest: |
193 | return new QEvent(*e); |
194 | |
195 | case QEvent::IconDrag: |
196 | return new QIconDragEvent(*static_cast<QIconDragEvent*>(e)); |
197 | |
198 | case QEvent::FontChange: |
199 | return new QEvent(*e); |
200 | case QEvent::EnabledChange: |
201 | return new QEvent(*e); |
202 | case QEvent::ActivationChange: |
203 | return new QEvent(*e); |
204 | case QEvent::StyleChange: |
205 | return new QEvent(*e); |
206 | case QEvent::IconTextChange: |
207 | return new QEvent(*e); |
208 | case QEvent::ModifiedChange: |
209 | return new QEvent(*e); |
210 | case QEvent::MouseTrackingChange: |
211 | return new QEvent(*e); |
212 | |
213 | case QEvent::WindowBlocked: |
214 | return new QEvent(*e); |
215 | case QEvent::WindowUnblocked: |
216 | return new QEvent(*e); |
217 | case QEvent::WindowStateChange: |
218 | return new QWindowStateChangeEvent(*static_cast<QWindowStateChangeEvent*>(e)); |
219 | |
220 | case QEvent::ToolTip: |
221 | return new QHelpEvent(*static_cast<QHelpEvent*>(e)); |
222 | case QEvent::WhatsThis: |
223 | return new QHelpEvent(*static_cast<QHelpEvent*>(e)); |
224 | |
225 | #ifndef QT_NO_ACTION |
226 | case QEvent::ActionChanged: |
227 | case QEvent::ActionAdded: |
228 | case QEvent::ActionRemoved: |
229 | return new QActionEvent(*static_cast<QActionEvent*>(e)); |
230 | #endif |
231 | case QEvent::FileOpen: |
232 | return new QFileOpenEvent(*static_cast<QFileOpenEvent*>(e)); |
233 | |
234 | #ifndef QT_NO_SHORTCUT |
235 | case QEvent::Shortcut: |
236 | return new QShortcutEvent(*static_cast<QShortcutEvent*>(e)); |
237 | #endif //QT_NO_SHORTCUT |
238 | case QEvent::ShortcutOverride: |
239 | return new QKeyEvent(*static_cast<QKeyEvent*>(e)); |
240 | |
241 | #if QT_CONFIG(whatsthis) |
242 | case QEvent::WhatsThisClicked: |
243 | return new QWhatsThisClickedEvent(*static_cast<QWhatsThisClickedEvent*>(e)); |
244 | #endif // QT_CONFIG(whatsthis) |
245 | |
246 | case QEvent::ApplicationActivate: |
247 | return new QEvent(*e); |
248 | case QEvent::ApplicationDeactivate: |
249 | return new QEvent(*e); |
250 | |
251 | case QEvent::QueryWhatsThis: |
252 | return new QHelpEvent(*static_cast<QHelpEvent*>(e)); |
253 | case QEvent::EnterWhatsThisMode: |
254 | return new QEvent(*e); |
255 | case QEvent::LeaveWhatsThisMode: |
256 | return new QEvent(*e); |
257 | |
258 | case QEvent::ZOrderChange: |
259 | return new QEvent(*e); |
260 | |
261 | case QEvent::HoverEnter: |
262 | case QEvent::HoverLeave: |
263 | case QEvent::HoverMove: |
264 | return new QHoverEvent(*static_cast<QHoverEvent*>(e)); |
265 | |
266 | #ifdef QT_KEYPAD_NAVIGATION |
267 | case QEvent::EnterEditFocus: |
268 | return new QEvent(*e); |
269 | case QEvent::LeaveEditFocus: |
270 | return new QEvent(*e); |
271 | #endif |
272 | case QEvent::AcceptDropsChange: |
273 | return new QEvent(*e); |
274 | |
275 | case QEvent::ZeroTimerEvent: |
276 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
277 | break; |
278 | |
279 | case QEvent::KeyboardLayoutChange: |
280 | return new QEvent(*e); |
281 | |
282 | case QEvent::DynamicPropertyChange: |
283 | return new QDynamicPropertyChangeEvent(*static_cast<QDynamicPropertyChangeEvent*>(e)); |
284 | |
285 | #if QT_CONFIG(tabletevent) |
286 | case QEvent::TabletEnterProximity: |
287 | case QEvent::TabletLeaveProximity: |
288 | return new QTabletEvent(*static_cast<QTabletEvent*>(e)); |
289 | #endif // QT_CONFIG(tabletevent) |
290 | |
291 | case QEvent::NonClientAreaMouseMove: |
292 | case QEvent::NonClientAreaMouseButtonPress: |
293 | case QEvent::NonClientAreaMouseButtonRelease: |
294 | case QEvent::NonClientAreaMouseButtonDblClick: |
295 | return new QMouseEvent(*static_cast<QMouseEvent*>(e)); |
296 | |
297 | case QEvent::MacSizeChange: |
298 | return new QEvent(*e); |
299 | |
300 | case QEvent::ContentsRectChange: |
301 | return new QEvent(*e); |
302 | |
303 | case QEvent::MacGLWindowChange: |
304 | return new QEvent(*e); |
305 | |
306 | case QEvent::FutureCallOut: |
307 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
308 | break; |
309 | case QEvent::CursorChange: |
310 | return new QEvent(*e); |
311 | case QEvent::ToolTipChange: |
312 | return new QEvent(*e); |
313 | |
314 | case QEvent::NetworkReplyUpdated: |
315 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
316 | break; |
317 | |
318 | case QEvent::GrabMouse: |
319 | case QEvent::UngrabMouse: |
320 | case QEvent::GrabKeyboard: |
321 | case QEvent::UngrabKeyboard: |
322 | return new QEvent(*e); |
323 | |
324 | case QEvent::TouchBegin: |
325 | case QEvent::TouchUpdate: |
326 | case QEvent::TouchEnd: |
327 | return new QTouchEvent(*static_cast<QTouchEvent*>(e)); |
328 | |
329 | #ifndef QT_NO_GESTURES |
330 | case QEvent::NativeGesture: |
331 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
332 | break; |
333 | #endif |
334 | |
335 | case QEvent::User: |
336 | case QEvent::MaxUser: |
337 | Q_ASSERT_X(false, "cloneEvent()" , "not implemented" ); |
338 | break; |
339 | default: |
340 | ; |
341 | } |
342 | return QCoreApplicationPrivate::cloneEvent(e); |
343 | } |
344 | |
345 | QT_END_NAMESPACE |
346 | |