1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
|
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qstatemachine.h>
#ifndef QT_NO_STATEMACHINE
#include <private/qstatemachine_p.h>
#include <QtGui/qevent.h>
#include <QtGui/qgraphicssceneevent.h>
QT_BEGIN_NAMESPACE
Q_CORE_EXPORT const QStateMachinePrivate::Handler *qcoreStateMachineHandler();
static QEvent *cloneEvent(QEvent *e)
{
switch (e->type()) {
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
case QEvent::MouseMove:
return new QMouseEvent(*static_cast<QMouseEvent*>(e));
case QEvent::KeyPress:
case QEvent::KeyRelease:
return new QKeyEvent(*static_cast<QKeyEvent*>(e));
case QEvent::FocusIn:
case QEvent::FocusOut:
return new QFocusEvent(*static_cast<QFocusEvent*>(e));
case QEvent::Enter:
return new QEvent(*e);
case QEvent::Leave:
return new QEvent(*e);
break;
case QEvent::Paint:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
case QEvent::Move:
return new QMoveEvent(*static_cast<QMoveEvent*>(e));
case QEvent::Resize:
return new QResizeEvent(*static_cast<QResizeEvent*>(e));
case QEvent::Create:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
case QEvent::Destroy:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
case QEvent::Show:
return new QShowEvent(*static_cast<QShowEvent*>(e));
case QEvent::Hide:
return new QHideEvent(*static_cast<QHideEvent*>(e));
case QEvent::Close:
return new QCloseEvent(*static_cast<QCloseEvent*>(e));
case QEvent::Quit:
return new QEvent(*e);
case QEvent::ParentChange:
return new QEvent(*e);
case QEvent::ParentAboutToChange:
return new QEvent(*e);
case QEvent::ThreadChange:
return new QEvent(*e);
case QEvent::WindowActivate:
case QEvent::WindowDeactivate:
return new QEvent(*e);
case QEvent::ShowToParent:
return new QEvent(*e);
case QEvent::HideToParent:
return new QEvent(*e);
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
return new QWheelEvent(*static_cast<QWheelEvent*>(e));
#endif //QT_NO_WHEELEVENT
case QEvent::WindowTitleChange:
return new QEvent(*e);
case QEvent::WindowIconChange:
return new QEvent(*e);
case QEvent::ApplicationWindowIconChange:
return new QEvent(*e);
case QEvent::ApplicationFontChange:
return new QEvent(*e);
case QEvent::ApplicationLayoutDirectionChange:
return new QEvent(*e);
case QEvent::ApplicationPaletteChange:
return new QEvent(*e);
case QEvent::PaletteChange:
return new QEvent(*e);
case QEvent::Clipboard:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
case QEvent::Speech:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
case QEvent::MetaCall:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
case QEvent::SockAct:
return new QEvent(*e);
case QEvent::WinEventAct:
return new QEvent(*e);
case QEvent::DeferredDelete:
return new QEvent(*e);
#ifndef QT_NO_DRAGANDDROP
case QEvent::DragEnter:
return new QDragEnterEvent(*static_cast<QDragEnterEvent*>(e));
case QEvent::DragMove:
return new QDragMoveEvent(*static_cast<QDragMoveEvent*>(e));
case QEvent::DragLeave:
return new QDragLeaveEvent(*static_cast<QDragLeaveEvent*>(e));
case QEvent::Drop:
return new QDropEvent(*static_cast<QDragMoveEvent*>(e));
case QEvent::DragResponse:
return new QDragResponseEvent(*static_cast<QDragResponseEvent*>(e));
#endif
case QEvent::ChildAdded:
return new QChildEvent(*static_cast<QChildEvent*>(e));
case QEvent::ChildPolished:
return new QChildEvent(*static_cast<QChildEvent*>(e));
#ifdef QT3_SUPPORT
case QEvent::ChildInsertedRequest:
return new QEvent(*e);
case QEvent::ChildInserted:
return new QChildEvent(*static_cast<QChildEvent*>(e));
case QEvent::LayoutHint:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
#endif
case QEvent::ChildRemoved:
return new QChildEvent(*static_cast<QChildEvent*>(e));
case QEvent::ShowWindowRequest:
return new QEvent(*e);
case QEvent::PolishRequest:
return new QEvent(*e);
case QEvent::Polish:
return new QEvent(*e);
case QEvent::LayoutRequest:
return new QEvent(*e);
case QEvent::UpdateRequest:
return new QEvent(*e);
case QEvent::UpdateLater:
return new QEvent(*e);
case QEvent::EmbeddingControl:
return new QEvent(*e);
case QEvent::ActivateControl:
return new QEvent(*e);
case QEvent::DeactivateControl:
return new QEvent(*e);
#ifndef QT_NO_CONTEXTMENU
case QEvent::ContextMenu:
return new QContextMenuEvent(*static_cast<QContextMenuEvent*>(e));
#endif
case QEvent::InputMethod:
return new QInputMethodEvent(*static_cast<QInputMethodEvent*>(e));
case QEvent::AccessibilityPrepare:
return new QEvent(*e);
#ifndef QT_NO_TABLETEVENT
case QEvent::TabletMove:
return new QTabletEvent(*static_cast<QTabletEvent*>(e));
#endif //QT_NO_TABLETEVENT
case QEvent::LocaleChange:
return new QEvent(*e);
case QEvent::LanguageChange:
return new QEvent(*e);
case QEvent::LayoutDirectionChange:
return new QEvent(*e);
case QEvent::Style:
return new QEvent(*e);
#ifndef QT_NO_TABLETEVENT
case QEvent::TabletPress:
return new QTabletEvent(*static_cast<QTabletEvent*>(e));
case QEvent::TabletRelease:
return new QTabletEvent(*static_cast<QTabletEvent*>(e));
#endif //QT_NO_TABLETEVENT
case QEvent::OkRequest:
return new QEvent(*e);
case QEvent::HelpRequest:
return new QEvent(*e);
case QEvent::IconDrag:
return new QIconDragEvent(*static_cast<QIconDragEvent*>(e));
case QEvent::FontChange:
return new QEvent(*e);
case QEvent::EnabledChange:
return new QEvent(*e);
case QEvent::ActivationChange:
return new QEvent(*e);
case QEvent::StyleChange:
return new QEvent(*e);
case QEvent::IconTextChange:
return new QEvent(*e);
case QEvent::ModifiedChange:
return new QEvent(*e);
case QEvent::MouseTrackingChange:
return new QEvent(*e);
case QEvent::WindowBlocked:
return new QEvent(*e);
case QEvent::WindowUnblocked:
return new QEvent(*e);
case QEvent::WindowStateChange:
return new QWindowStateChangeEvent(*static_cast<QWindowStateChangeEvent*>(e));
case QEvent::ToolTip:
return new QHelpEvent(*static_cast<QHelpEvent*>(e));
case QEvent::WhatsThis:
return new QHelpEvent(*static_cast<QHelpEvent*>(e));
#ifndef QT_NO_STATUSTIP
case QEvent::StatusTip:
return new QStatusTipEvent(*static_cast<QStatusTipEvent*>(e));
#endif //QT_NO_STATUSTIP
#ifndef QT_NO_ACTION
case QEvent::ActionChanged:
case QEvent::ActionAdded:
case QEvent::ActionRemoved:
return new QActionEvent(*static_cast<QActionEvent*>(e));
#endif
case QEvent::FileOpen:
return new QFileOpenEvent(*static_cast<QFileOpenEvent*>(e));
#ifndef QT_NO_SHORTCUT
case QEvent::Shortcut:
return new QShortcutEvent(*static_cast<QShortcutEvent*>(e));
#endif //QT_NO_SHORTCUT
case QEvent::ShortcutOverride:
return new QKeyEvent(*static_cast<QKeyEvent*>(e));
#ifdef QT3_SUPPORT
case QEvent::Accel:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
case QEvent::AccelAvailable:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
#endif
#ifndef QT_NO_WHATSTHIS
case QEvent::WhatsThisClicked:
return new QWhatsThisClickedEvent(*static_cast<QWhatsThisClickedEvent*>(e));
#endif //QT_NO_WHATSTHIS
#ifndef QT_NO_TOOLBAR
case QEvent::ToolBarChange:
return new QToolBarChangeEvent(*static_cast<QToolBarChangeEvent*>(e));
#endif //QT_NO_TOOLBAR
case QEvent::ApplicationActivate:
return new QEvent(*e);
case QEvent::ApplicationDeactivate:
return new QEvent(*e);
case QEvent::QueryWhatsThis:
return new QHelpEvent(*static_cast<QHelpEvent*>(e));
case QEvent::EnterWhatsThisMode:
return new QEvent(*e);
case QEvent::LeaveWhatsThisMode:
return new QEvent(*e);
case QEvent::ZOrderChange:
return new QEvent(*e);
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::HoverMove:
return new QHoverEvent(*static_cast<QHoverEvent*>(e));
case QEvent::AccessibilityHelp:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
case QEvent::AccessibilityDescription:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
#ifdef QT_KEYPAD_NAVIGATION
case QEvent::EnterEditFocus:
return new QEvent(*e);
case QEvent::LeaveEditFocus:
return new QEvent(*e);
#endif
case QEvent::AcceptDropsChange:
return new QEvent(*e);
#ifdef QT3_SUPPORT
case QEvent::MenubarUpdated:
return new QMenubarUpdatedEvent(*static_cast<QMenubarUpdatedEvent*>(e));
#endif
case QEvent::ZeroTimerEvent:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
#ifndef QT_NO_GRAPHICSVIEW
case QEvent::GraphicsSceneMouseMove:
case QEvent::GraphicsSceneMousePress:
case QEvent::GraphicsSceneMouseRelease:
case QEvent::GraphicsSceneMouseDoubleClick: {
QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent*>(e);
QGraphicsSceneMouseEvent *me2 = new QGraphicsSceneMouseEvent(me->type());
me2->setWidget(me->widget());
me2->setPos(me->pos());
me2->setScenePos(me->scenePos());
me2->setScreenPos(me->screenPos());
// ### for all buttons
me2->setButtonDownPos(Qt::LeftButton, me->buttonDownPos(Qt::LeftButton));
me2->setButtonDownPos(Qt::RightButton, me->buttonDownPos(Qt::RightButton));
me2->setButtonDownScreenPos(Qt::LeftButton, me->buttonDownScreenPos(Qt::LeftButton));
me2->setButtonDownScreenPos(Qt::RightButton, me->buttonDownScreenPos(Qt::RightButton));
me2->setLastPos(me->lastPos());
me2->setLastScenePos(me->lastScenePos());
me2->setLastScreenPos(me->lastScreenPos());
me2->setButtons(me->buttons());
me2->setButton(me->button());
me2->setModifiers(me->modifiers());
return me2;
}
case QEvent::GraphicsSceneContextMenu: {
QGraphicsSceneContextMenuEvent *me = static_cast<QGraphicsSceneContextMenuEvent*>(e);
QGraphicsSceneContextMenuEvent *me2 = new QGraphicsSceneContextMenuEvent(me->type());
me2->setWidget(me->widget());
me2->setPos(me->pos());
me2->setScenePos(me->scenePos());
me2->setScreenPos(me->screenPos());
me2->setModifiers(me->modifiers());
me2->setReason(me->reason());
return me2;
}
case QEvent::GraphicsSceneHoverEnter:
case QEvent::GraphicsSceneHoverMove:
case QEvent::GraphicsSceneHoverLeave: {
QGraphicsSceneHoverEvent *he = static_cast<QGraphicsSceneHoverEvent*>(e);
QGraphicsSceneHoverEvent *he2 = new QGraphicsSceneHoverEvent(he->type());
he2->setPos(he->pos());
he2->setScenePos(he->scenePos());
he2->setScreenPos(he->screenPos());
he2->setLastPos(he->lastPos());
he2->setLastScenePos(he->lastScenePos());
he2->setLastScreenPos(he->lastScreenPos());
he2->setModifiers(he->modifiers());
return he2;
}
case QEvent::GraphicsSceneHelp:
return new QHelpEvent(*static_cast<QHelpEvent*>(e));
case QEvent::GraphicsSceneDragEnter:
case QEvent::GraphicsSceneDragMove:
case QEvent::GraphicsSceneDragLeave:
case QEvent::GraphicsSceneDrop: {
QGraphicsSceneDragDropEvent *dde = static_cast<QGraphicsSceneDragDropEvent*>(e);
QGraphicsSceneDragDropEvent *dde2 = new QGraphicsSceneDragDropEvent(dde->type());
dde2->setPos(dde->pos());
dde2->setScenePos(dde->scenePos());
dde2->setScreenPos(dde->screenPos());
dde2->setButtons(dde->buttons());
dde2->setModifiers(dde->modifiers());
return dde2;
}
case QEvent::GraphicsSceneWheel: {
QGraphicsSceneWheelEvent *we = static_cast<QGraphicsSceneWheelEvent*>(e);
QGraphicsSceneWheelEvent *we2 = new QGraphicsSceneWheelEvent(we->type());
we2->setPos(we->pos());
we2->setScenePos(we->scenePos());
we2->setScreenPos(we->screenPos());
we2->setButtons(we->buttons());
we2->setModifiers(we->modifiers());
we2->setOrientation(we->orientation());
we2->setDelta(we->delta());
return we2;
}
#endif
case QEvent::KeyboardLayoutChange:
return new QEvent(*e);
case QEvent::DynamicPropertyChange:
return new QDynamicPropertyChangeEvent(*static_cast<QDynamicPropertyChangeEvent*>(e));
#ifndef QT_NO_TABLETEVENT
case QEvent::TabletEnterProximity:
case QEvent::TabletLeaveProximity:
return new QTabletEvent(*static_cast<QTabletEvent*>(e));
#endif //QT_NO_TABLETEVENT
case QEvent::NonClientAreaMouseMove:
case QEvent::NonClientAreaMouseButtonPress:
case QEvent::NonClientAreaMouseButtonRelease:
case QEvent::NonClientAreaMouseButtonDblClick:
return new QMouseEvent(*static_cast<QMouseEvent*>(e));
case QEvent::MacSizeChange:
return new QEvent(*e);
case QEvent::ContentsRectChange:
return new QEvent(*e);
case QEvent::MacGLWindowChange:
return new QEvent(*e);
case QEvent::FutureCallOut:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
#ifndef QT_NO_GRAPHICSVIEW
case QEvent::GraphicsSceneResize: {
QGraphicsSceneResizeEvent *re = static_cast<QGraphicsSceneResizeEvent*>(e);
QGraphicsSceneResizeEvent *re2 = new QGraphicsSceneResizeEvent();
re2->setOldSize(re->oldSize());
re2->setNewSize(re->newSize());
return re2;
}
case QEvent::GraphicsSceneMove: {
QGraphicsSceneMoveEvent *me = static_cast<QGraphicsSceneMoveEvent*>(e);
QGraphicsSceneMoveEvent *me2 = new QGraphicsSceneMoveEvent();
me2->setWidget(me->widget());
me2->setNewPos(me->newPos());
me2->setOldPos(me->oldPos());
return me2;
}
#endif
case QEvent::CursorChange:
return new QEvent(*e);
case QEvent::ToolTipChange:
return new QEvent(*e);
case QEvent::NetworkReplyUpdated:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
case QEvent::GrabMouse:
case QEvent::UngrabMouse:
case QEvent::GrabKeyboard:
case QEvent::UngrabKeyboard:
return new QEvent(*e);
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
return new QTouchEvent(*static_cast<QTouchEvent*>(e));
#ifndef QT_NO_GESTURES
case QEvent::NativeGesture:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
#endif
case QEvent::RequestSoftwareInputPanel:
case QEvent::CloseSoftwareInputPanel:
return new QEvent(*e);
case QEvent::UpdateSoftKeys:
return new QEvent(*e);
case QEvent::User:
case QEvent::MaxUser:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
default:
;
}
return qcoreStateMachineHandler()->cloneEvent(e);
}
const QStateMachinePrivate::Handler qt_gui_statemachine_handler = {
cloneEvent
};
static const QStateMachinePrivate::Handler *qt_guistatemachine_last_handler = 0;
int qRegisterGuiStateMachine()
{
qt_guistatemachine_last_handler = QStateMachinePrivate::handler;
QStateMachinePrivate::handler = &qt_gui_statemachine_handler;
return 1;
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiStateMachine)
int qUnregisterGuiStateMachine()
{
QStateMachinePrivate::handler = qt_guistatemachine_last_handler;
return 1;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiStateMachine)
QT_END_NAMESPACE
#endif //QT_NO_STATEMACHINE
|