Qt 4.2: QCustomEvent Class Reference

|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QCustomEvent Class Reference
[QtCore module]

The QCustomEvent class provides support for custom events. More...

     #include <QCustomEvent>

This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information.

Inherits QEvent.

- List of all members, including inherited members
- Qt 3 support members

### Additional Inherited Members

- 1 property inherited from QEvent
- 6 public functions inherited from QEvent

## Detailed Description

The QCustomEvent class provides support for custom events.

QCustomEvent has a `void *` that can be used to store custom data.

In Qt 3, QObject::customEvent() took a QCustomEvent pointer. We found out that this approach was unsatisfactory, because there was often no safe way of deleting the data held in the `void *`.

In Qt 4, QObject::customEvent() takes a plain QEvent pointer. You can add custom data by subclassing.

See also QObject::customEvent() and QCoreApplication::notify().

## Member Function Documentation

### QCustomEvent::QCustomEvent ( int type, void * data = 0 )

Constructs a custom event object with the event type and a pointer to data. The value of type must be at least as large as QEvent::User. By default, the data pointer is set to 0.

### void * QCustomEvent::data () const

Returns a pointer to the generic event data.

See also setData().

### void QCustomEvent::setData ( void * data )

Sets the generic data pointer to data.

See also data().