com.trolltech.qt.core
Class QEvent

java.lang.Object
  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, 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.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
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 callign setAccepted(true).
static QEvent fromNativePointer(QNativePointer nativePointer)
          This function returns the QEvent instance pointed to by nativePointer
 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
 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.
 QEvent.Type type()
          Returns the event type.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, 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 callign 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.

See Also:
isAccepted

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.


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.


fromNativePointer

public static QEvent fromNativePointer(QNativePointer nativePointer)
This function returns the QEvent instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.