Qt Jambi Home

com.trolltech.qt.core
Class QAbstractEventDispatcher

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.core.QAbstractEventDispatcher
All Implemented Interfaces:
QtJambiInterface

public abstract class QAbstractEventDispatcher
extends QObject

The QAbstractEventDispatcher class provides an interface to manage Qt's event queue.

An event dispatcher receives events from the window system and other sources. It then sends them to the QCoreApplication or QApplication instance for processing and delivery. QAbstractEventDispatcher provides fine-grained control over event delivery.

For simple control of event processing use QCoreApplication::processEvents().

For finer control of the application's event loop, call instance and call functions on the QAbstractEventDispatcher object that is returned. If you want to use your own instance of QAbstractEventDispatcher or of a QAbstractEventDispatcher subclass, you must create your instance before you create the QApplication object.

The main event loop is started by calling QCoreApplication::exec(), and stopped by calling QCoreApplication::exit(). Local event loops can be created using QEventLoop.

Programs that perform long operations can call processEvents with a bitwise OR combination of various QEventLoop::ProcessEventsFlag values to control which events should be delivered.

QAbstractEventDispatcher also allows the integration of an external event loop with the Qt event loop. For example, the Motif Extension included with Qt includes a reimplementation of QAbstractEventDispatcher that merges Qt and Motif events together.

See Also:
QEventLoop, QCoreApplication

Nested Class Summary
 
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>
 
Field Summary
 QSignalEmitter.Signal0 aboutToBlock
          This signal is emitted before the event loop calls a function that could block.
 QSignalEmitter.Signal0 awake
          This signal is emitted after the event loop returns from a function that could block.
 
Constructor Summary
QAbstractEventDispatcher()
          Equivalent to QAbstractEventDispatcher(0).
QAbstractEventDispatcher(QObject parent)
          Constructs a new event dispatcher with the given parent.
 
Method Summary
 void closingDown()
          
abstract  void flush()
          Flushes the event queue.
static QAbstractEventDispatcher fromNativePointer(QNativePointer nativePointer)
          This function returns the QAbstractEventDispatcher instance pointed to by nativePointer
abstract  boolean hasPendingEvents()
          Returns true if there is an event waiting; otherwise returns false.
static QAbstractEventDispatcher instance()
          Equivalent to instance(0).
static QAbstractEventDispatcher instance(java.lang.Thread thread)
          Returns a pointer to the event dispatcher object for the specified thread.
abstract  void interrupt()
          Interrupts event dispatching; i.e. the event dispatcher will return from processEvents as soon as possible.
abstract  boolean processEvents(QEventLoop.ProcessEventsFlags flags)
          Processes pending events that match flags until there are no more events to process.
abstract  java.util.List<QPair<java.lang.Integer,java.lang.Integer>> registeredTimers(QObject object)
          Returns a list of registered timers for object.
abstract  void registerSocketNotifier(QSocketNotifier notifier)
          Registers notifier with the event loop.
abstract  void registerTimer(int timerId, int interval, QObject object)
          Register a timer with the specified timerId and interval for the given object.
 int registerTimer(int interval, QObject object)
          Registers a timer with the specified interval for the given object.
 void startingUp()
          
abstract  void unregisterSocketNotifier(QSocketNotifier notifier)
          Unregisters notifier from the event dispatcher.
abstract  boolean unregisterTimer(int timerId)
          Unregisters the timer with the given timerId.
abstract  boolean unregisterTimers(QObject object)
          Unregisters all the timers associated with the given object.
abstract  void wakeUp()
          Wakes up the event loop.
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
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
 

Field Detail

aboutToBlock

public final QSignalEmitter.Signal0 aboutToBlock

This signal is emitted before the event loop calls a function that could block.

Compatible Slot Signature:
void mySlot()
See Also:
awake


awake

public final QSignalEmitter.Signal0 awake

This signal is emitted after the event loop returns from a function that could block.

Compatible Slot Signature:
void mySlot()
See Also:
wakeUp, aboutToBlock

Constructor Detail

QAbstractEventDispatcher

public QAbstractEventDispatcher()

Equivalent to QAbstractEventDispatcher(0).


QAbstractEventDispatcher

public QAbstractEventDispatcher(QObject parent)

Constructs a new event dispatcher with the given parent.

Method Detail

registerTimer

public final int registerTimer(int interval,
                               QObject object)

Registers a timer with the specified interval for the given object.


closingDown

public void closingDown()


flush

public abstract void flush()

Flushes the event queue. This normally returns almost immediately. Does nothing on platforms other than X11.


hasPendingEvents

public abstract boolean hasPendingEvents()

Returns true if there is an event waiting; otherwise returns false.


interrupt

public abstract void interrupt()

Interrupts event dispatching; i.e. the event dispatcher will return from processEvents as soon as possible.


processEvents

public abstract boolean processEvents(QEventLoop.ProcessEventsFlags flags)

Processes pending events that match flags until there are no more events to process. Returns true if an event was processed; otherwise returns false.

This function is especially useful if you have a long running operation and want to show its progress without allowing user input; i.e. by using the QEventLoop::ExcludeUserInputEvents flag.

If the QEventLoop::WaitForMoreEvents flag is set in flags, the behavior of this function is as follows:

If the QEventLoop::WaitForMoreEvents flag is not set in flags, and no events are available, this function will return immediately.

Note: This function does not process events continuously; it returns after all available events are processed.

See Also:
hasPendingEvents

registerSocketNotifier

public abstract void registerSocketNotifier(QSocketNotifier notifier)

Registers notifier with the event loop. Subclasses must implement this method to tie a socket notifier into another event loop.


registerTimer

public abstract void registerTimer(int timerId,
                                   int interval,
                                   QObject object)

Register a timer with the specified timerId and interval for the given object.


registeredTimers

public abstract java.util.List<QPair<java.lang.Integer,java.lang.Integer>> registeredTimers(QObject object)

Returns a list of registered timers for object. The timer ID is the first member in each pair; the interval is the second.


startingUp

public void startingUp()


unregisterSocketNotifier

public abstract void unregisterSocketNotifier(QSocketNotifier notifier)

Unregisters notifier from the event dispatcher. Subclasses must reimplement this method to tie a socket notifier into another event loop. Reimplementations must call the base implementation.


unregisterTimer

public abstract boolean unregisterTimer(int timerId)

Unregisters the timer with the given timerId. Returns true if successful; otherwise returns false.

See Also:
registerTimer, unregisterTimers

unregisterTimers

public abstract boolean unregisterTimers(QObject object)

Unregisters all the timers associated with the given object. Returns true if all timers were successful removed; otherwise returns false.

See Also:
unregisterTimer, registeredTimers

wakeUp

public abstract void wakeUp()

Wakes up the event loop.

See Also:
awake

instance

public static QAbstractEventDispatcher instance()

Equivalent to instance(0).


instance

public static QAbstractEventDispatcher instance(java.lang.Thread thread)

Returns a pointer to the event dispatcher object for the specified thread. If thread is zero, the current thread is used. If no event dispatcher exists for the specified thread, this function returns 0.

Note: If Qt is built without thread support, the thread argument is ignored.


fromNativePointer

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

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

Qt Jambi Home