author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Mon, 04 Oct 2010 01:19:32 +0300 | |
changeset 37 | 758a864f9613 |
parent 30 | 5dc02b23752f |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtCore module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#include "qcoreevent.h" |
|
43 |
#include "qcoreapplication.h" |
|
44 |
#include "qcoreapplication_p.h" |
|
45 |
||
46 |
#include "qmutex.h" |
|
47 |
#include "qset.h" |
|
48 |
||
49 |
QT_BEGIN_NAMESPACE |
|
50 |
||
51 |
/*! |
|
52 |
\class QEvent |
|
53 |
\brief The QEvent class is the base class of all |
|
54 |
event classes. Event objects contain event parameters. |
|
55 |
||
56 |
\ingroup events |
|
57 |
||
58 |
Qt's main event loop (QCoreApplication::exec()) fetches native |
|
59 |
window system events from the event queue, translates them into |
|
60 |
QEvents, and sends the translated events to \l{QObject}s. |
|
61 |
||
62 |
In general, events come from the underlying window system |
|
63 |
(spontaneous() returns true), but it is also possible to manually |
|
64 |
send events using QCoreApplication::sendEvent() and |
|
65 |
QCoreApplication::postEvent() (spontaneous() returns false). |
|
66 |
||
67 |
QObjects receive events by having their QObject::event() function |
|
68 |
called. The function can be reimplemented in subclasses to |
|
69 |
customize event handling and add additional event types; |
|
70 |
QWidget::event() is a notable example. By default, events are |
|
71 |
dispatched to event handlers like QObject::timerEvent() and |
|
72 |
QWidget::mouseMoveEvent(). QObject::installEventFilter() allows an |
|
73 |
object to intercept events destined for another object. |
|
74 |
||
75 |
The basic QEvent contains only an event type parameter and an |
|
76 |
"accept" flag. The accept flag set with accept(), and cleared |
|
77 |
with ignore(). It is set by default, but don't rely on this as |
|
78 |
subclasses may choose to clear it in their constructor. |
|
79 |
||
80 |
Subclasses of QEvent contain additional parameters that describe |
|
81 |
the particular event. |
|
82 |
||
83 |
\sa QObject::event(), QObject::installEventFilter(), |
|
84 |
QWidget::event(), QCoreApplication::sendEvent(), |
|
85 |
QCoreApplication::postEvent(), QCoreApplication::processEvents() |
|
86 |
*/ |
|
87 |
||
88 |
||
89 |
/*! |
|
90 |
\enum QEvent::Type |
|
91 |
||
92 |
This enum type defines the valid event types in Qt. The event |
|
93 |
types and the specialized classes for each type are as follows: |
|
94 |
||
95 |
\value None Not an event. |
|
96 |
\value AccessibilityDescription Used to query accessibility description texts (QAccessibleEvent). |
|
97 |
\value AccessibilityHelp Used to query accessibility help texts (QAccessibleEvent). |
|
98 |
\value AccessibilityPrepare Accessibility information is requested. |
|
99 |
\value ActionAdded A new action has been added (QActionEvent). |
|
100 |
\value ActionChanged An action has been changed (QActionEvent). |
|
101 |
\value ActionRemoved An action has been removed (QActionEvent). |
|
102 |
\value ActivationChange A widget's top-level window activation state has changed. |
|
103 |
\value ApplicationActivate The application has been made available to the user. |
|
104 |
\value ApplicationActivated This enum has been deprecated. Use ApplicationActivate instead. |
|
105 |
\value ApplicationDeactivate The application has been suspended, and is unavailable to the user. |
|
106 |
\value ApplicationFontChange The default application font has changed. |
|
107 |
\value ApplicationLayoutDirectionChange The default application layout direction has changed. |
|
108 |
\value ApplicationPaletteChange The default application palette has changed. |
|
109 |
\value ApplicationWindowIconChange The application's icon has changed. |
|
110 |
\value ChildAdded An object gets a child (QChildEvent). |
|
111 |
\value ChildInserted An object gets a child (QChildEvent). Qt3Support only, use ChildAdded instead. |
|
112 |
\value ChildPolished A widget child gets polished (QChildEvent). |
|
113 |
\value ChildRemoved An object loses a child (QChildEvent). |
|
114 |
\value Clipboard The clipboard contents have changed (QClipboardEvent). |
|
115 |
\value Close Widget was closed (QCloseEvent). |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
116 |
\value CloseSoftwareInputPanel A widget wants to close the software input panel (SIP). |
0 | 117 |
\value ContentsRectChange The margins of the widget's content rect changed. |
118 |
\value ContextMenu Context popup menu (QContextMenuEvent). |
|
119 |
\value CursorChange The widget's cursor has changed. |
|
120 |
\value DeferredDelete The object will be deleted after it has cleaned up. |
|
121 |
\value DragEnter The cursor enters a widget during a drag and drop operation (QDragEnterEvent). |
|
122 |
\value DragLeave The cursor leaves a widget during a drag and drop operation (QDragLeaveEvent). |
|
123 |
\value DragMove A drag and drop operation is in progress (QDragMoveEvent). |
|
124 |
\value Drop A drag and drop operation is completed (QDropEvent). |
|
125 |
\value EnabledChange Widget's enabled state has changed. |
|
126 |
\value Enter Mouse enters widget's boundaries. |
|
127 |
\value EnterEditFocus An editor widget gains focus for editing. |
|
128 |
\value EnterWhatsThisMode Send to toplevel widgets when the application enters "What's This?" mode. |
|
129 |
\value FileOpen File open request (QFileOpenEvent). |
|
130 |
\value FocusIn Widget gains keyboard focus (QFocusEvent). |
|
131 |
\value FocusOut Widget loses keyboard focus (QFocusEvent). |
|
132 |
\value FontChange Widget's font has changed. |
|
133 |
\value GrabKeyboard Item gains keyboard grab (QGraphicsItem only). |
|
134 |
\value GrabMouse Item gains mouse grab (QGraphicsItem only). |
|
135 |
\value GraphicsSceneContextMenu Context popup menu over a graphics scene (QGraphicsSceneContextMenuEvent). |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
136 |
\value GraphicsSceneDragEnter The cursor enters a graphics scene during a drag and drop operation (QGraphicsSceneDragDropEvent). |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
137 |
\value GraphicsSceneDragLeave The cursor leaves a graphics scene during a drag and drop operation (QGraphicsSceneDragDropEvent). |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
138 |
\value GraphicsSceneDragMove A drag and drop operation is in progress over a scene (QGraphicsSceneDragDropEvent). |
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
139 |
\value GraphicsSceneDrop A drag and drop operation is completed over a scene (QGraphicsSceneDragDropEvent). |
0 | 140 |
\value GraphicsSceneHelp The user requests help for a graphics scene (QHelpEvent). |
141 |
\value GraphicsSceneHoverEnter The mouse cursor enters a hover item in a graphics scene (QGraphicsSceneHoverEvent). |
|
142 |
\value GraphicsSceneHoverLeave The mouse cursor leaves a hover item in a graphics scene (QGraphicsSceneHoverEvent). |
|
143 |
\value GraphicsSceneHoverMove The mouse cursor moves inside a hover item in a graphics scene (QGraphicsSceneHoverEvent). |
|
144 |
\value GraphicsSceneMouseDoubleClick Mouse press again (double click) in a graphics scene (QGraphicsSceneMouseEvent). |
|
145 |
\value GraphicsSceneMouseMove Move mouse in a graphics scene (QGraphicsSceneMouseEvent). |
|
146 |
\value GraphicsSceneMousePress Mouse press in a graphics scene (QGraphicsSceneMouseEvent). |
|
147 |
\value GraphicsSceneMouseRelease Mouse release in a graphics scene (QGraphicsSceneMouseEvent). |
|
148 |
\value GraphicsSceneMove Widget was moved (QGraphicsSceneMoveEvent). |
|
149 |
\value GraphicsSceneResize Widget was resized (QGraphicsSceneResizeEvent). |
|
150 |
\value GraphicsSceneWheel Mouse wheel rolled in a graphics scene (QGraphicsSceneWheelEvent). |
|
151 |
\value Hide Widget was hidden (QHideEvent). |
|
152 |
\value HideToParent A child widget has been hidden. |
|
153 |
\value HoverEnter The mouse cursor enters a hover widget (QHoverEvent). |
|
154 |
\value HoverLeave The mouse cursor leaves a hover widget (QHoverEvent). |
|
155 |
\value HoverMove The mouse cursor moves inside a hover widget (QHoverEvent). |
|
156 |
\value IconDrag The main icon of a window has been dragged away (QIconDragEvent). |
|
157 |
\value IconTextChange Widget's icon text has been changed. |
|
158 |
\value InputMethod An input method is being used (QInputMethodEvent). |
|
159 |
\value KeyPress Key press (QKeyEvent). |
|
160 |
\value KeyRelease Key release (QKeyEvent). |
|
161 |
\value LanguageChange The application translation changed. |
|
162 |
\value LayoutDirectionChange The direction of layouts changed. |
|
163 |
\value LayoutRequest Widget layout needs to be redone. |
|
164 |
\value Leave Mouse leaves widget's boundaries. |
|
165 |
\value LeaveEditFocus An editor widget loses focus for editing. |
|
166 |
\value LeaveWhatsThisMode Send to toplevel widgets when the application leaves "What's This?" mode. |
|
167 |
\value LocaleChange The system locale has changed. |
|
168 |
\value NonClientAreaMouseButtonDblClick A mouse double click occurred outside the client area. |
|
169 |
\value NonClientAreaMouseButtonPress A mouse button press occurred outside the client area. |
|
170 |
\value NonClientAreaMouseButtonRelease A mouse button release occurred outside the client area. |
|
171 |
\value NonClientAreaMouseMove A mouse move occurred outside the client area. |
|
172 |
\value MacSizeChange The user changed his widget sizes (Mac OS X only). |
|
173 |
\value MenubarUpdated The window's menu bar has been updated. |
|
174 |
\value MetaCall An asynchronous method invocation via QMetaObject::invokeMethod(). |
|
175 |
\value ModifiedChange Widgets modification state has been changed. |
|
176 |
\value MouseButtonDblClick Mouse press again (QMouseEvent). |
|
177 |
\value MouseButtonPress Mouse press (QMouseEvent). |
|
178 |
\value MouseButtonRelease Mouse release (QMouseEvent). |
|
179 |
\value MouseMove Mouse move (QMouseEvent). |
|
180 |
\value MouseTrackingChange The mouse tracking state has changed. |
|
181 |
\value Move Widget's position changed (QMoveEvent). |
|
182 |
\value Paint Screen update necessary (QPaintEvent). |
|
183 |
\value PaletteChange Palette of the widget changed. |
|
184 |
\value ParentAboutToChange The widget parent is about to change. |
|
185 |
\value ParentChange The widget parent has changed. |
|
186 |
\value Polish The widget is polished. |
|
187 |
\value PolishRequest The widget should be polished. |
|
188 |
\value QueryWhatsThis The widget should accept the event if it has "What's This?" help. |
|
189 |
\value RequestSoftwareInputPanel A widget wants to open a software input panel (SIP). |
|
190 |
\value Resize Widget's size changed (QResizeEvent). |
|
191 |
\value Shortcut Key press in child for shortcut key handling (QShortcutEvent). |
|
192 |
\value ShortcutOverride Key press in child, for overriding shortcut key handling (QKeyEvent). |
|
193 |
\value Show Widget was shown on screen (QShowEvent). |
|
194 |
\value ShowToParent A child widget has been shown. |
|
195 |
\value SockAct Socket activated, used to implement QSocketNotifier. |
|
196 |
\value StateMachineSignal A signal delivered to a state machine (QStateMachine::SignalEvent). |
|
197 |
\value StateMachineWrapped The event is a wrapper for, i.e., contains, another event (QStateMachine::WrappedEvent). |
|
198 |
\value StatusTip A status tip is requested (QStatusTipEvent). |
|
199 |
\value StyleChange Widget's style has been changed. |
|
200 |
\value TabletMove Wacom tablet move (QTabletEvent). |
|
201 |
\value TabletPress Wacom tablet press (QTabletEvent). |
|
202 |
\value TabletRelease Wacom tablet release (QTabletEvent). |
|
203 |
\value OkRequest Ok button in decoration pressed. Supported only for Windows CE. |
|
204 |
\value TabletEnterProximity Wacom tablet enter proximity event (QTabletEvent), sent to QApplication. |
|
205 |
\value TabletLeaveProximity Wacom tablet leave proximity event (QTabletEvent), sent to QApplication. |
|
206 |
\value Timer Regular timer events (QTimerEvent). |
|
207 |
\value ToolBarChange The toolbar button is toggled on Mac OS X. |
|
208 |
\value ToolTip A tooltip was requested (QHelpEvent). |
|
209 |
\value ToolTipChange The widget's tooltip has changed. |
|
210 |
\value UngrabKeyboard Item loses keyboard grab (QGraphicsItem only). |
|
211 |
\value UngrabMouse Item loses mouse grab (QGraphicsItem only). |
|
212 |
\value UpdateLater The widget should be queued to be repainted at a later time. |
|
213 |
\value UpdateRequest The widget should be repainted. |
|
214 |
\value WhatsThis The widget should reveal "What's This?" help (QHelpEvent). |
|
215 |
\value WhatsThisClicked A link in a widget's "What's This?" help was clicked. |
|
216 |
\value Wheel Mouse wheel rolled (QWheelEvent). |
|
217 |
\value WinEventAct A Windows-specific activation event has occurred. |
|
218 |
\value WindowActivate Window was activated. |
|
219 |
\value WindowBlocked The window is blocked by a modal dialog. |
|
220 |
\value WindowDeactivate Window was deactivated. |
|
221 |
\value WindowIconChange The window's icon has changed. |
|
222 |
\value WindowStateChange The \l{QWidget::windowState()}{window's state} (minimized, maximized or full-screen) has changed (QWindowStateChangeEvent). |
|
223 |
\value WindowTitleChange The window title has changed. |
|
224 |
\value WindowUnblocked The window is unblocked after a modal dialog exited. |
|
225 |
\value ZOrderChange The widget's z-order has changed. This event is never sent to top level windows. |
|
226 |
\value KeyboardLayoutChange The keyboard layout has changed. |
|
227 |
\value DynamicPropertyChange A dynamic property was added, changed or removed from the object. |
|
228 |
\value TouchBegin Beginning of a sequence of touch-screen and/or track-pad events (QTouchEvent) |
|
229 |
\value TouchUpdate Touch-screen event (QTouchEvent) |
|
230 |
\value TouchEnd End of touch-event sequence (QTouchEvent) |
|
231 |
\value WinIdChange The window system identifer for this native widget has changed |
|
232 |
\value Gesture A gesture was triggered (QGestureEvent) |
|
233 |
\value GestureOverride A gesture override was triggered (QGestureEvent) |
|
234 |
||
235 |
User events should have values between \c User and \c{MaxUser}: |
|
236 |
||
237 |
\value User User-defined event. |
|
238 |
\value MaxUser Last user event ID. |
|
239 |
||
240 |
For convenience, you can use the registerEventType() function to |
|
241 |
register and reserve a custom event type for your |
|
242 |
application. Doing so will allow you to avoid accidentally |
|
243 |
re-using a custom event type already in use elsewhere in your |
|
244 |
application. |
|
245 |
||
246 |
\omitvalue Accel |
|
247 |
\omitvalue AccelAvailable |
|
248 |
\omitvalue AccelOverride |
|
249 |
\omitvalue AcceptDropsChange |
|
250 |
\omitvalue ActivateControl |
|
251 |
\omitvalue CaptionChange |
|
252 |
\omitvalue ChildInsertedRequest |
|
253 |
\omitvalue ChildInserted |
|
254 |
\omitvalue Create |
|
255 |
\omitvalue DeactivateControl |
|
256 |
\omitvalue Destroy |
|
257 |
\omitvalue DragResponse |
|
258 |
\omitvalue EmbeddingControl |
|
259 |
\omitvalue HelpRequest |
|
260 |
\omitvalue IconChange |
|
261 |
\omitvalue LayoutHint |
|
262 |
\omitvalue Quit |
|
263 |
\omitvalue Reparent |
|
264 |
\omitvalue ShowWindowRequest |
|
265 |
\omitvalue Speech |
|
266 |
\omitvalue Style |
|
267 |
\omitvalue ThreadChange |
|
268 |
\omitvalue ZeroTimerEvent |
|
269 |
\omitvalue ApplicationActivated |
|
270 |
\omitvalue ApplicationDeactivated |
|
271 |
\omitvalue MacGLWindowChange |
|
272 |
\omitvalue MacGLClearDrawable |
|
273 |
\omitvalue NetworkReplyUpdated |
|
274 |
\omitvalue FutureCallOut |
|
275 |
\omitvalue UpdateSoftKeys |
|
276 |
\omitvalue NativeGesture |
|
277 |
*/ |
|
278 |
||
279 |
/*! |
|
280 |
Contructs an event object of type \a type. |
|
281 |
*/ |
|
282 |
QEvent::QEvent(Type type) |
|
283 |
: d(0), t(type), posted(false), spont(false), m_accept(true) |
|
284 |
{} |
|
285 |
||
286 |
/*! |
|
287 |
Destroys the event. If it was \link |
|
288 |
QCoreApplication::postEvent() posted \endlink, |
|
289 |
it will be removed from the list of events to be posted. |
|
290 |
*/ |
|
291 |
||
292 |
QEvent::~QEvent() |
|
293 |
{ |
|
294 |
if (posted && QCoreApplication::instance()) |
|
295 |
QCoreApplicationPrivate::removePostedEvent(this); |
|
296 |
} |
|
297 |
||
298 |
||
299 |
/*! |
|
300 |
\property QEvent::accepted |
|
301 |
the accept flag of the event object |
|
302 |
||
303 |
Setting the accept parameter indicates that the event receiver |
|
304 |
wants the event. Unwanted events might be propagated to the parent |
|
305 |
widget. By default, isAccepted() is set to true, but don't rely on |
|
306 |
this as subclasses may choose to clear it in their constructor. |
|
307 |
||
308 |
For convenience, the accept flag can also be set with accept(), |
|
309 |
and cleared with ignore(). |
|
310 |
*/ |
|
311 |
||
312 |
/*! |
|
313 |
\fn void QEvent::accept() |
|
314 |
||
315 |
Sets the accept flag of the event object, the equivalent of |
|
316 |
calling setAccepted(true). |
|
317 |
||
318 |
Setting the accept parameter indicates that the event receiver |
|
319 |
wants the event. Unwanted events might be propagated to the parent |
|
320 |
widget. |
|
321 |
||
322 |
\sa ignore() |
|
323 |
*/ |
|
324 |
||
325 |
||
326 |
/*! |
|
327 |
\fn void QEvent::ignore() |
|
328 |
||
329 |
Clears the accept flag parameter of the event object, the |
|
330 |
equivalent of calling setAccepted(false). |
|
331 |
||
332 |
Clearing the accept parameter indicates that the event receiver |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
333 |
does not want the event. Unwanted events might be propagated to the |
0 | 334 |
parent widget. |
335 |
||
336 |
\sa accept() |
|
337 |
*/ |
|
338 |
||
339 |
||
340 |
/*! |
|
341 |
\fn QEvent::Type QEvent::type() const |
|
342 |
||
343 |
Returns the event type. |
|
344 |
*/ |
|
345 |
||
346 |
/*! |
|
347 |
\fn bool QEvent::spontaneous() const |
|
348 |
||
349 |
Returns true if the event originated outside the application (a |
|
350 |
system event); otherwise returns false. |
|
351 |
||
352 |
The return value of this function is not defined for paint events. |
|
353 |
*/ |
|
354 |
||
355 |
class QEventUserEventRegistration |
|
356 |
{ |
|
357 |
public: |
|
358 |
QMutex mutex; |
|
359 |
QSet<int> set; |
|
360 |
}; |
|
361 |
Q_GLOBAL_STATIC(QEventUserEventRegistration, userEventRegistrationHelper) |
|
362 |
||
363 |
/*! |
|
364 |
\since 4.4 |
|
365 |
\threadsafe |
|
366 |
||
367 |
Registers and returns a custom event type. The \a hint provided |
|
368 |
will be used if it is available, otherwise it will return a value |
|
369 |
between QEvent::User and QEvent::MaxUser that has not yet been |
|
370 |
registered. The \a hint is ignored if its value is not between |
|
371 |
QEvent::User and QEvent::MaxUser. |
|
372 |
*/ |
|
373 |
int QEvent::registerEventType(int hint) |
|
374 |
{ |
|
375 |
QEventUserEventRegistration *userEventRegistration |
|
376 |
= userEventRegistrationHelper(); |
|
377 |
if (!userEventRegistration) |
|
378 |
return -1; |
|
379 |
||
380 |
QMutexLocker locker(&userEventRegistration->mutex); |
|
381 |
||
382 |
// if the type hint hasn't been registered yet, take it |
|
383 |
if (hint >= QEvent::User && hint <= QEvent::MaxUser && !userEventRegistration->set.contains(hint)) { |
|
384 |
userEventRegistration->set.insert(hint); |
|
385 |
return hint; |
|
386 |
} |
|
387 |
||
388 |
// find a free event type, starting at MaxUser and decreasing |
|
389 |
int id = QEvent::MaxUser; |
|
390 |
while (userEventRegistration->set.contains(id) && id >= QEvent::User) |
|
391 |
--id; |
|
392 |
if (id >= QEvent::User) { |
|
393 |
userEventRegistration->set.insert(id); |
|
394 |
return id; |
|
395 |
} |
|
396 |
return -1; |
|
397 |
} |
|
398 |
||
399 |
/*! |
|
400 |
\class QTimerEvent |
|
401 |
\brief The QTimerEvent class contains parameters that describe a |
|
402 |
timer event. |
|
403 |
||
404 |
\ingroup events |
|
405 |
||
406 |
Timer events are sent at regular intervals to objects that have |
|
407 |
started one or more timers. Each timer has a unique identifier. A |
|
408 |
timer is started with QObject::startTimer(). |
|
409 |
||
410 |
The QTimer class provides a high-level programming interface that |
|
411 |
uses signals instead of events. It also provides single-shot timers. |
|
412 |
||
413 |
The event handler QObject::timerEvent() receives timer events. |
|
414 |
||
415 |
\sa QTimer, QObject::timerEvent(), QObject::startTimer(), |
|
416 |
QObject::killTimer() |
|
417 |
*/ |
|
418 |
||
419 |
/*! |
|
420 |
Constructs a timer event object with the timer identifier set to |
|
421 |
\a timerId. |
|
422 |
*/ |
|
423 |
QTimerEvent::QTimerEvent(int timerId) |
|
424 |
: QEvent(Timer), id(timerId) |
|
425 |
{} |
|
426 |
||
427 |
/*! \internal |
|
428 |
*/ |
|
429 |
QTimerEvent::~QTimerEvent() |
|
430 |
{ |
|
431 |
} |
|
432 |
||
433 |
/*! |
|
434 |
\fn int QTimerEvent::timerId() const |
|
435 |
||
436 |
Returns the unique timer identifier, which is the same identifier |
|
437 |
as returned from QObject::startTimer(). |
|
438 |
*/ |
|
439 |
||
440 |
/*! |
|
441 |
\class QChildEvent |
|
442 |
\brief The QChildEvent class contains event parameters for child object |
|
443 |
events. |
|
444 |
||
445 |
\ingroup events |
|
446 |
||
447 |
Child events are sent immediately to objects when children are |
|
448 |
added or removed. |
|
449 |
||
450 |
In both cases you can only rely on the child being a QObject (or, |
|
451 |
if QObject::isWidgetType() returns true, a QWidget). This is |
|
452 |
because in the QEvent::ChildAdded case the child is not yet fully |
|
453 |
constructed; in the QEvent::ChildRemoved case it might have |
|
454 |
already been destructed. |
|
455 |
||
456 |
The handler for these events is QObject::childEvent(). |
|
457 |
*/ |
|
458 |
||
459 |
/*! |
|
460 |
Constructs a child event object of a particular \a type for the |
|
461 |
\a child. |
|
462 |
||
463 |
\a type can be QEvent::ChildAdded, QEvent::ChildRemoved, |
|
464 |
QEvent::ChildPolished, or QEvent::ChildRemoved. |
|
465 |
||
466 |
\sa child() |
|
467 |
*/ |
|
468 |
QChildEvent::QChildEvent(Type type, QObject *child) |
|
469 |
: QEvent(type), c(child) |
|
470 |
{} |
|
471 |
||
472 |
/*! \internal |
|
473 |
*/ |
|
474 |
QChildEvent::~QChildEvent() |
|
475 |
{ |
|
476 |
} |
|
477 |
||
478 |
/*! |
|
479 |
\fn QObject *QChildEvent::child() const |
|
480 |
||
481 |
Returns the child object that was added or removed. |
|
482 |
*/ |
|
483 |
||
484 |
/*! |
|
485 |
\fn bool QChildEvent::added() const |
|
486 |
||
487 |
Returns true if type() is QEvent::ChildAdded; otherwise returns |
|
488 |
false. |
|
489 |
*/ |
|
490 |
||
491 |
/*! |
|
492 |
\fn bool QChildEvent::removed() const |
|
493 |
||
494 |
Returns true if type() is QEvent::ChildRemoved; otherwise returns |
|
495 |
false. |
|
496 |
*/ |
|
497 |
||
498 |
/*! |
|
499 |
\fn bool QChildEvent::polished() const |
|
500 |
||
501 |
Returns true if type() is QEvent::ChildPolished; otherwise returns |
|
502 |
false. |
|
503 |
*/ |
|
504 |
||
505 |
/*! |
|
506 |
\class QCustomEvent |
|
507 |
\brief The QCustomEvent class provides support for custom events. |
|
508 |
||
509 |
\compat |
|
510 |
||
511 |
QCustomEvent has a \c{void *} that can be used to store custom |
|
512 |
data. |
|
513 |
||
514 |
In Qt 3, QObject::customEvent() took a QCustomEvent pointer. We |
|
515 |
found out that this approach was unsatisfactory, because |
|
516 |
there was often no safe way of deleting the data held in the |
|
517 |
\c{void *}. |
|
518 |
||
519 |
In Qt 4, QObject::customEvent() takes a plain QEvent pointer. |
|
520 |
You can add custom data by subclassing. |
|
521 |
||
522 |
\sa QObject::customEvent(), QCoreApplication::notify() |
|
523 |
*/ |
|
524 |
||
525 |
/*! |
|
526 |
\fn QCustomEvent::QCustomEvent(int type, void *data) |
|
527 |
||
528 |
Constructs a custom event object with the event \a type and a |
|
529 |
pointer to \a data. The value of \a type must be at least as |
|
530 |
large as QEvent::User. By default, the data pointer is set to 0. |
|
531 |
*/ |
|
532 |
#ifdef QT3_SUPPORT |
|
533 |
QCustomEvent::QCustomEvent(int type, void *data) |
|
534 |
: QEvent(static_cast<Type>(type)) |
|
535 |
{ |
|
536 |
d = reinterpret_cast<QEventPrivate *>(data); |
|
537 |
} |
|
538 |
||
539 |
/*! \internal |
|
540 |
*/ |
|
541 |
QCustomEvent::~QCustomEvent() |
|
542 |
{ |
|
543 |
} |
|
544 |
#endif |
|
545 |
/*! |
|
546 |
\fn void QCustomEvent::setData(void *data) |
|
547 |
||
548 |
\compat |
|
549 |
||
550 |
Sets the generic data pointer to \a data. |
|
551 |
||
552 |
\sa data() |
|
553 |
*/ |
|
554 |
||
555 |
/*! |
|
556 |
\fn void *QCustomEvent::data() const |
|
557 |
||
558 |
\compat |
|
559 |
||
560 |
Returns a pointer to the generic event data. |
|
561 |
||
562 |
\sa setData() |
|
563 |
*/ |
|
564 |
||
565 |
/*! |
|
566 |
\fn bool QChildEvent::inserted() const |
|
567 |
||
568 |
\compat |
|
569 |
||
570 |
A child has been inserted if the event's type() is ChildInserted. |
|
571 |
*/ |
|
572 |
||
573 |
/*! |
|
574 |
\class QDynamicPropertyChangeEvent |
|
575 |
\since 4.2 |
|
576 |
\brief The QDynamicPropertyChangeEvent class contains event parameters for dynamic |
|
577 |
property change events. |
|
578 |
||
579 |
\ingroup events |
|
580 |
||
581 |
Dynamic property change events are sent to objects when properties are |
|
582 |
dynamically added, changed or removed using QObject::setProperty(). |
|
583 |
*/ |
|
584 |
||
585 |
/*! |
|
586 |
Constructs a dynamic property change event object with the property name set to |
|
587 |
\a name. |
|
588 |
*/ |
|
589 |
QDynamicPropertyChangeEvent::QDynamicPropertyChangeEvent(const QByteArray &name) |
|
590 |
: QEvent(QEvent::DynamicPropertyChange), n(name) |
|
591 |
{ |
|
592 |
} |
|
593 |
||
594 |
/*! |
|
595 |
\internal |
|
596 |
*/ |
|
597 |
QDynamicPropertyChangeEvent::~QDynamicPropertyChangeEvent() |
|
598 |
{ |
|
599 |
} |
|
600 |
||
601 |
/*! |
|
602 |
\fn QByteArray QDynamicPropertyChangeEvent::propertyName() const |
|
603 |
||
604 |
Returns the name of the dynamic property that was added, changed or |
|
605 |
removed. |
|
606 |
||
607 |
\sa QObject::setProperty(), QObject::dynamicPropertyNames() |
|
608 |
*/ |
|
609 |
||
610 |
QT_END_NAMESPACE |