com.trolltech.qt.core
Class QEventLoop

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.QObject
                  extended by com.trolltech.qt.core.QEventLoop
All Implemented Interfaces:
QtJambiInterface

public class QEventLoop
extends QObject

The QEventLoop class provides a means of entering and leaving an event loop. At any time, you can create a QEventLoop object and call exec() on it to start a local event loop. From within the event loop, calling exit() will force exec() to return.

See also:
QAbstractEventDispatcher.


Nested Class Summary
static class QEventLoop.ProcessEventsFlag
          This enum controls the types of events processed by the processEvents() functions.
static class QEventLoop.ProcessEventsFlags
           
 
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
QEventLoop()
          Constructs an event loop object with the given parent.
QEventLoop(QObject parent)
          Constructs an event loop object with the given parent.
 
Method Summary
 int exec()
          Enters the main event loop and waits until exit() is called.
 int exec(QEventLoop.ProcessEventsFlag[] flags)
          This is an overloaded method provided for convenience.
 int exec(QEventLoop.ProcessEventsFlags flags)
          Enters the main event loop and waits until exit() is called.
 void exit()
          Tells the event loop to exit with a return code.
 void exit(int returnCode)
          Tells the event loop to exit with a return code.
 boolean isRunning()
          Returns true if the event loop is running; otherwise returns false.
 boolean processEvents()
          Processes pending events that match flags until there are no more events to process.
 boolean processEvents(QEventLoop.ProcessEventsFlag[] flags)
          This is an overloaded method provided for convenience.
 boolean processEvents(QEventLoop.ProcessEventsFlags flags)
          Processes pending events that match flags until there are no more events to process.
 void processEvents(QEventLoop.ProcessEventsFlags flags, int maximumTime)
          Process pending events that match flags for a maximum of maxTime milliseconds, or until there are no more events to process, whichever is shorter.
 void quit()
          Tells the event loop to exit normally.
 void wakeUp()
          Wakes up the event loop.
 
Methods inherited from class com.trolltech.qt.core.QObject
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty
 
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

QEventLoop

public QEventLoop()
Constructs an event loop object with the given parent.


QEventLoop

public QEventLoop(QObject parent)
Constructs an event loop object with the given parent.

Method Detail

exec

public final int exec(QEventLoop.ProcessEventsFlag[] flags)
This is an overloaded method provided for convenience.


exec

public final int exec()
Enters the main event loop and waits until exit() is called. Returns the value that was passed to exit().

If flags are specified, only events of the types allowed by the flags will be processed.

It is necessary to call this function to start event handling. The main event loop receives events from the window system and dispatches these to the application widgets.

Generally speaking, no user interaction can take place before calling exec(). As a special case, modal widgets like QMessageBox can be used before calling exec(), because modal widgets use their own local event loop.

To make your application perform idle processing (i.e. executing a special function whenever there are no pending events), use a QTimer with 0 timeout. More sophisticated idle processing schemes can be achieved using processEvents().

See also:
QApplication::quit(), exit(), and processEvents().


exec

public final int exec(QEventLoop.ProcessEventsFlags flags)
Enters the main event loop and waits until exit() is called. Returns the value that was passed to exit().

If flags are specified, only events of the types allowed by the flags will be processed.

It is necessary to call this function to start event handling. The main event loop receives events from the window system and dispatches these to the application widgets.

Generally speaking, no user interaction can take place before calling exec(). As a special case, modal widgets like QMessageBox can be used before calling exec(), because modal widgets use their own local event loop.

To make your application perform idle processing (i.e. executing a special function whenever there are no pending events), use a QTimer with 0 timeout. More sophisticated idle processing schemes can be achieved using processEvents().

See also:
QApplication::quit(), exit(), and processEvents().


exit

public final void exit()
Tells the event loop to exit with a return code.

After this function has been called, the event loop returns from the call to exec(). The exec() function returns returnCode.

By convention, a returnCode of 0 means success, and any non-zero value indicates an error.

Note that unlike the C library function of the same name, this function does return to the caller -- it is event processing that stops.

See also:
QCoreApplication::quit(), quit(), and exec().


exit

public final void exit(int returnCode)
Tells the event loop to exit with a return code.

After this function has been called, the event loop returns from the call to exec(). The exec() function returns returnCode.

By convention, a returnCode of 0 means success, and any non-zero value indicates an error.

Note that unlike the C library function of the same name, this function does return to the caller -- it is event processing that stops.

See also:
QCoreApplication::quit(), quit(), and exec().


isRunning

public final boolean isRunning()
Returns true if the event loop is running; otherwise returns false. The event loop is considered running from the time when exec() is called until exit() is called.

See also:
exec(), and exit().


processEvents

public final boolean processEvents(QEventLoop.ProcessEventsFlag[] flags)
This is an overloaded method provided for convenience.


processEvents

public final boolean processEvents()
Processes pending events that match flags until there are no more events to process. Returns true if pending events were handled; 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 ExcludeUserInputEvents flag.

This function is simply a wrapper for QAbstractEventDispatcher::processEvents(). See the documentation for that function for details.


processEvents

public final boolean processEvents(QEventLoop.ProcessEventsFlags flags)
Processes pending events that match flags until there are no more events to process. Returns true if pending events were handled; 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 ExcludeUserInputEvents flag.

This function is simply a wrapper for QAbstractEventDispatcher::processEvents(). See the documentation for that function for details.


processEvents

public final void processEvents(QEventLoop.ProcessEventsFlags flags,
                                int maximumTime)
Process pending events that match flags for a maximum of maxTime milliseconds, or until there are no more events to process, whichever is shorter. 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 ExcludeUserInputEvents flag.

Notes:


quit

public final void quit()
Tells the event loop to exit normally.

Same as exit(0).

See also:
QCoreApplication::quit(), and exit().


wakeUp

public final void wakeUp()
Wakes up the event loop.

See also:
QAbstractEventDispatcher::wakeUp().