com.trolltech.qt.core
Class QEvent

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QEvent
All Implemented Interfaces:
QtJambiInterface
Direct Known Subclasses:
QAccessibleEvent, QActionEvent, QChildEvent, QClipboardEvent, QCloseEvent, QDragLeaveEvent, QDragResponseEvent, QDropEvent, QDynamicPropertyChangeEvent, QFileOpenEvent, QFocusEvent, QGraphicsSceneEvent, QHelpEvent, QHideEvent, QHoverEvent, QIconDragEvent, QInputEvent, QInputMethodEvent, QMoveEvent, QPaintEvent, QResizeEvent, QShortcutEvent, QShowEvent, QStatusTipEvent, QTimerEvent, QToolBarChangeEvent, QWhatsThisClickedEvent, QWindowStateChangeEvent

public class QEvent
extends QtJambiObject

The QEvent class is the base class of all event classes. Event objects contain event parameters. Qt's main event loop (QCoreApplication::exec()) fetches native window system events from the event queue, translates them into QEvents, and sends the translated events to QObjects.

In general, events come from the underlying window system (spontaneous() returns true), but it is also possible to manually send events using QCoreApplication::sendEvent() and QCoreApplication::postEvent() (spontaneous() returns false).

QObjects receive events by having their QObject::event() function called. The function can be reimplemented in subclasses to customize event handling and add additional event types; QWidget::event() is a notable example. By default, events are dispatched to event handlers like QObject::timerEvent() and QWidget::mouseMoveEvent(). QObject::installEventFilter() allows an object to intercept events destined for another object.

The basic QEvent contains only an event type parameter and an "accept" flag. The accept flag set with accept(), and cleared with ignore(). It is set by default, but don't rely on this as subclasses may choose to clear it in their constructor.

Subclasses of QEvent contain additional parameters that describe the particular event.

See also:
QObject::event(), QObject::installEventFilter(), QWidget::event(), QCoreApplication::sendEvent(), QCoreApplication::postEvent(), and QCoreApplication::processEvents().


Nested Class Summary
static class QEvent.Type
          This enum type defines the valid event types in Qt.
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
QEvent(QEvent.Type type)
          Contructs an event object of type type.
 
Method Summary
 void accept()
          Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
 void ignore()
          Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
 boolean isAccepted()
          the accept flag of the event object
static int registerEventType()
          Registers and returns a custom event type.
static int registerEventType(int hint)
          Registers and returns a custom event type.
 void setAccepted(boolean accepted)
          the accept flag of the event object
protected  void setT(char t)
          Sets the type of this QEvent to t.
 boolean spontaneous()
          Returns true if the event originated outside the application (a system event); otherwise returns false.
protected  char t()
          Returns the type of this QEvent.
 java.lang.String toString()
          Returns a string representation of the this QEvent.
 QEvent.Type type()
          Returns the event type.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QEvent

public QEvent(QEvent.Type type)
Contructs an event object of type type.

Method Detail

accept

public final void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget.

See also:
ignore().


ignore

public final void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).

Clearing the accept parameter indicates that the event receiver does not want the event. Unwanted events might be propgated to the parent widget.

See also:
accept().


isAccepted

public final boolean isAccepted()
the accept flag of the event object

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget. By default, isAccepted() is set to true, but don't rely on this as subclasses may choose to clear it in their constructor.

For convenience, the accept flag can also be set with accept(), and cleared with ignore().


setAccepted

public final void setAccepted(boolean accepted)
the accept flag of the event object

Setting the accept parameter indicates that the event receiver wants the event. Unwanted events might be propagated to the parent widget. By default, isAccepted() is set to true, but don't rely on this as subclasses may choose to clear it in their constructor.

For convenience, the accept flag can also be set with accept(), and cleared with ignore().


spontaneous

public final boolean spontaneous()
Returns true if the event originated outside the application (a system event); otherwise returns false.

The return value of this function is not defined for paint events.


type

public final QEvent.Type type()
Returns the event type.


registerEventType

public static int registerEventType()
Registers and returns a custom event type. The hint provided will be used if it is available, otherwise it will return a value between QEvent::User and QEvent::MaxUser that has not yet been registered. The hint is ignored if its value is not between QEvent::User and QEvent::MaxUser .


registerEventType

public static int registerEventType(int hint)
Registers and returns a custom event type. The hint provided will be used if it is available, otherwise it will return a value between QEvent::User and QEvent::MaxUser that has not yet been registered. The hint is ignored if its value is not between QEvent::User and QEvent::MaxUser .


setT

protected final void setT(char t)
Sets the type of this QEvent to t.


t

protected final char t()
Returns the type of this QEvent.


toString

public java.lang.String toString()
Returns a string representation of the this QEvent.

Overrides:
toString in class java.lang.Object