QEventLoop Class

The QEventLoop class provides a means of entering and leaving an event loop. More...

Header: #include <QEventLoop>
qmake: QT += core
Inherits: QObject

Public Types

enum ProcessEventsFlag { AllEvents, ExcludeUserInputEvents, ExcludeSocketNotifiers, WaitForMoreEvents }

Detailed Description

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.

Member Type Documentation

enum QEventLoop::ProcessEventsFlag

This enum controls the types of events processed by the processEvents() functions.

ConstantValueDescription
QEventLoop::AllEvents0x00All events. Note that DeferredDelete events are processed specially. See QObject::deleteLater() for more details.
QEventLoop::ExcludeUserInputEvents0x01Do not process user input events, such as ButtonPress and KeyPress. Note that the events are not discarded; they will be delivered the next time processEvents() is called without the ExcludeUserInputEvents flag.
QEventLoop::ExcludeSocketNotifiers0x02Do not process socket notifier events. Note that the events are not discarded; they will be delivered the next time processEvents() is called without the ExcludeSocketNotifiers flag.
QEventLoop::WaitForMoreEvents0x04Wait for events if no pending events are available.

See also processEvents().