src/corelib/kernel/qcoreevent.cpp
changeset 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     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 CloseSoftwareInputPanel          A widget wants to close the software input panel (SIP).
       
   111     \value ChildAdded                       An object gets a child (QChildEvent).
       
   112     \value ChildInserted                    An object gets a child (QChildEvent). Qt3Support only, use ChildAdded instead.
       
   113     \value ChildPolished                    A widget child gets polished (QChildEvent).
       
   114     \value ChildRemoved                     An object loses a child (QChildEvent).
       
   115     \value Clipboard                        The clipboard contents have changed (QClipboardEvent).
       
   116     \value Close                            Widget was closed (QCloseEvent).
       
   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).
       
   136     \value GraphicsSceneDragEnter           The cursor enters a graphics scene during a drag and drop operation.
       
   137     \value GraphicsSceneDragLeave           The cursor leaves a graphics scene during a drag and drop operation.
       
   138     \value GraphicsSceneDragMove            A drag and drop operation is in progress over a scene.
       
   139     \value GraphicsSceneDrop                A drag and drop operation is completed over a scene.
       
   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 CocoaRequestModal
       
   276     \omitvalue UpdateSoftKeys
       
   277     \omitvalue NativeGesture
       
   278 */
       
   279 
       
   280 /*!
       
   281     Contructs an event object of type \a type.
       
   282 */
       
   283 QEvent::QEvent(Type type)
       
   284     : d(0), t(type), posted(false), spont(false), m_accept(true)
       
   285 {}
       
   286 
       
   287 /*!
       
   288     Destroys the event. If it was \link
       
   289     QCoreApplication::postEvent() posted \endlink,
       
   290     it will be removed from the list of events to be posted.
       
   291 */
       
   292 
       
   293 QEvent::~QEvent()
       
   294 {
       
   295     if (posted && QCoreApplication::instance())
       
   296         QCoreApplicationPrivate::removePostedEvent(this);
       
   297 }
       
   298 
       
   299 
       
   300 /*!
       
   301     \property  QEvent::accepted
       
   302     the accept flag of the event object
       
   303 
       
   304     Setting the accept parameter indicates that the event receiver
       
   305     wants the event. Unwanted events might be propagated to the parent
       
   306     widget. By default, isAccepted() is set to true, but don't rely on
       
   307     this as subclasses may choose to clear it in their constructor.
       
   308 
       
   309     For convenience, the accept flag can also be set with accept(),
       
   310     and cleared with ignore().
       
   311 */
       
   312 
       
   313 /*!
       
   314     \fn void QEvent::accept()
       
   315 
       
   316     Sets the accept flag of the event object, the equivalent of
       
   317     calling setAccepted(true).
       
   318 
       
   319     Setting the accept parameter indicates that the event receiver
       
   320     wants the event. Unwanted events might be propagated to the parent
       
   321     widget.
       
   322 
       
   323     \sa ignore()
       
   324 */
       
   325 
       
   326 
       
   327 /*!
       
   328     \fn void QEvent::ignore()
       
   329 
       
   330     Clears the accept flag parameter of the event object, the
       
   331     equivalent of calling setAccepted(false).
       
   332 
       
   333     Clearing the accept parameter indicates that the event receiver
       
   334     does not want the event. Unwanted events might be propgated to the
       
   335     parent widget.
       
   336 
       
   337     \sa accept()
       
   338 */
       
   339 
       
   340 
       
   341 /*!
       
   342     \fn QEvent::Type QEvent::type() const
       
   343 
       
   344     Returns the event type.
       
   345 */
       
   346 
       
   347 /*!
       
   348     \fn bool QEvent::spontaneous() const
       
   349 
       
   350     Returns true if the event originated outside the application (a
       
   351     system event); otherwise returns false.
       
   352 
       
   353     The return value of this function is not defined for paint events.
       
   354 */
       
   355 
       
   356 class QEventUserEventRegistration
       
   357 {
       
   358 public:
       
   359     QMutex mutex;
       
   360     QSet<int> set;
       
   361 };
       
   362 Q_GLOBAL_STATIC(QEventUserEventRegistration, userEventRegistrationHelper)
       
   363 
       
   364 /*!
       
   365     \since 4.4
       
   366     \threadsafe
       
   367 
       
   368     Registers and returns a custom event type. The \a hint provided
       
   369     will be used if it is available, otherwise it will return a value
       
   370     between QEvent::User and QEvent::MaxUser that has not yet been
       
   371     registered. The \a hint is ignored if its value is not between
       
   372     QEvent::User and QEvent::MaxUser.
       
   373 */
       
   374 int QEvent::registerEventType(int hint)
       
   375 {
       
   376     QEventUserEventRegistration *userEventRegistration
       
   377         = userEventRegistrationHelper();
       
   378     if (!userEventRegistration)
       
   379         return -1;
       
   380 
       
   381     QMutexLocker locker(&userEventRegistration->mutex);
       
   382 
       
   383     // if the type hint hasn't been registered yet, take it
       
   384     if (hint >= QEvent::User && hint <= QEvent::MaxUser && !userEventRegistration->set.contains(hint)) {
       
   385         userEventRegistration->set.insert(hint);
       
   386         return hint;
       
   387     }
       
   388 
       
   389     // find a free event type, starting at MaxUser and decreasing
       
   390     int id = QEvent::MaxUser;
       
   391     while (userEventRegistration->set.contains(id) && id >= QEvent::User)
       
   392         --id;
       
   393     if (id >= QEvent::User) {
       
   394         userEventRegistration->set.insert(id);
       
   395         return id;
       
   396     }
       
   397     return -1;
       
   398 }
       
   399 
       
   400 /*!
       
   401     \class QTimerEvent
       
   402     \brief The QTimerEvent class contains parameters that describe a
       
   403     timer event.
       
   404 
       
   405     \ingroup events
       
   406 
       
   407     Timer events are sent at regular intervals to objects that have
       
   408     started one or more timers. Each timer has a unique identifier. A
       
   409     timer is started with QObject::startTimer().
       
   410 
       
   411     The QTimer class provides a high-level programming interface that
       
   412     uses signals instead of events. It also provides single-shot timers.
       
   413 
       
   414     The event handler QObject::timerEvent() receives timer events.
       
   415 
       
   416     \sa QTimer, QObject::timerEvent(), QObject::startTimer(),
       
   417     QObject::killTimer()
       
   418 */
       
   419 
       
   420 /*!
       
   421     Constructs a timer event object with the timer identifier set to
       
   422     \a timerId.
       
   423 */
       
   424 QTimerEvent::QTimerEvent(int timerId)
       
   425     : QEvent(Timer), id(timerId)
       
   426 {}
       
   427 
       
   428 /*! \internal
       
   429 */
       
   430 QTimerEvent::~QTimerEvent()
       
   431 {
       
   432 }
       
   433 
       
   434 /*!
       
   435     \fn int QTimerEvent::timerId() const
       
   436 
       
   437     Returns the unique timer identifier, which is the same identifier
       
   438     as returned from QObject::startTimer().
       
   439 */
       
   440 
       
   441 /*!
       
   442     \class QChildEvent
       
   443     \brief The QChildEvent class contains event parameters for child object
       
   444     events.
       
   445 
       
   446     \ingroup events
       
   447 
       
   448     Child events are sent immediately to objects when children are
       
   449     added or removed.
       
   450 
       
   451     In both cases you can only rely on the child being a QObject (or,
       
   452     if QObject::isWidgetType() returns true, a QWidget). This is
       
   453     because in the QEvent::ChildAdded case the child is not yet fully
       
   454     constructed; in the QEvent::ChildRemoved case it might have
       
   455     already been destructed.
       
   456 
       
   457     The handler for these events is QObject::childEvent().
       
   458 */
       
   459 
       
   460 /*!
       
   461     Constructs a child event object of a particular \a type for the
       
   462     \a child.
       
   463 
       
   464     \a type can be QEvent::ChildAdded, QEvent::ChildRemoved,
       
   465     QEvent::ChildPolished, or QEvent::ChildRemoved.
       
   466 
       
   467     \sa child()
       
   468 */
       
   469 QChildEvent::QChildEvent(Type type, QObject *child)
       
   470     : QEvent(type), c(child)
       
   471 {}
       
   472 
       
   473 /*! \internal
       
   474 */
       
   475 QChildEvent::~QChildEvent()
       
   476 {
       
   477 }
       
   478 
       
   479 /*!
       
   480     \fn QObject *QChildEvent::child() const
       
   481 
       
   482     Returns the child object that was added or removed.
       
   483 */
       
   484 
       
   485 /*!
       
   486     \fn bool QChildEvent::added() const
       
   487 
       
   488     Returns true if type() is QEvent::ChildAdded; otherwise returns
       
   489     false.
       
   490 */
       
   491 
       
   492 /*!
       
   493     \fn bool QChildEvent::removed() const
       
   494 
       
   495     Returns true if type() is QEvent::ChildRemoved; otherwise returns
       
   496     false.
       
   497 */
       
   498 
       
   499 /*!
       
   500     \fn bool QChildEvent::polished() const
       
   501 
       
   502     Returns true if type() is QEvent::ChildPolished; otherwise returns
       
   503     false.
       
   504 */
       
   505 
       
   506 /*!
       
   507     \class QCustomEvent
       
   508     \brief The QCustomEvent class provides support for custom events.
       
   509 
       
   510     \compat
       
   511 
       
   512     QCustomEvent has a \c{void *} that can be used to store custom
       
   513     data.
       
   514 
       
   515     In Qt 3, QObject::customEvent() took a QCustomEvent pointer. We
       
   516     found out that this approach was unsatisfactory, because
       
   517     there was often no safe way of deleting the data held in the
       
   518     \c{void *}.
       
   519 
       
   520     In Qt 4, QObject::customEvent() takes a plain QEvent pointer.
       
   521     You can add custom data by subclassing.
       
   522 
       
   523     \sa QObject::customEvent(), QCoreApplication::notify()
       
   524 */
       
   525 
       
   526 /*!
       
   527     \fn QCustomEvent::QCustomEvent(int type, void *data)
       
   528 
       
   529     Constructs a custom event object with the event \a type and a
       
   530     pointer to \a data. The value of \a type must be at least as
       
   531     large as QEvent::User. By default, the data pointer is set to 0.
       
   532 */
       
   533 #ifdef QT3_SUPPORT
       
   534 QCustomEvent::QCustomEvent(int type, void *data)
       
   535     : QEvent(static_cast<Type>(type))
       
   536 {
       
   537     d = reinterpret_cast<QEventPrivate *>(data);
       
   538 }
       
   539 
       
   540 /*! \internal
       
   541 */
       
   542 QCustomEvent::~QCustomEvent()
       
   543 {
       
   544 }
       
   545 #endif
       
   546 /*!
       
   547     \fn void QCustomEvent::setData(void *data)
       
   548 
       
   549     \compat
       
   550 
       
   551     Sets the generic data pointer to \a data.
       
   552 
       
   553     \sa data()
       
   554 */
       
   555 
       
   556 /*!
       
   557     \fn void *QCustomEvent::data() const
       
   558 
       
   559     \compat
       
   560 
       
   561     Returns a pointer to the generic event data.
       
   562 
       
   563     \sa setData()
       
   564 */
       
   565 
       
   566 /*!
       
   567     \fn bool QChildEvent::inserted() const
       
   568 
       
   569     \compat
       
   570 
       
   571     A child has been inserted if the event's type() is ChildInserted.
       
   572 */
       
   573 
       
   574 /*!
       
   575     \class QDynamicPropertyChangeEvent
       
   576     \since 4.2
       
   577     \brief The QDynamicPropertyChangeEvent class contains event parameters for dynamic
       
   578     property change events.
       
   579 
       
   580     \ingroup events
       
   581 
       
   582     Dynamic property change events are sent to objects when properties are
       
   583     dynamically added, changed or removed using QObject::setProperty().
       
   584 */
       
   585 
       
   586 /*!
       
   587     Constructs a dynamic property change event object with the property name set to
       
   588     \a name.
       
   589 */
       
   590 QDynamicPropertyChangeEvent::QDynamicPropertyChangeEvent(const QByteArray &name)
       
   591     : QEvent(QEvent::DynamicPropertyChange), n(name)
       
   592 {
       
   593 }
       
   594 
       
   595 /*!
       
   596     \internal
       
   597 */
       
   598 QDynamicPropertyChangeEvent::~QDynamicPropertyChangeEvent()
       
   599 {
       
   600 }
       
   601 
       
   602 /*!
       
   603     \fn QByteArray QDynamicPropertyChangeEvent::propertyName() const
       
   604 
       
   605     Returns the name of the dynamic property that was added, changed or
       
   606     removed.
       
   607 
       
   608     \sa QObject::setProperty(), QObject::dynamicPropertyNames()
       
   609 */
       
   610 
       
   611 QT_END_NAMESPACE