Table Of Contents

Previous topic

QAbstractEventDispatcher

Next topic

QCoreApplication

QEventLoop

Inheritance diagram of QEventLoop

Synopsis

Functions

Slots

Detailed Description

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

At any time, you can create a PySide.QtCore.QEventLoop object and call exec() on it to start a local event loop. From within the event loop, calling PySide.QtCore.QEventLoop.exit() will force exec() to return.

class PySide.QtCore.QEventLoop([parent=None])
Parameters:parentPySide.QtCore.QObject

Constructs an event loop object with the given parent .

PySide.QtCore.QEventLoop.ProcessEventsFlag

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

Constant Description
QEventLoop.AllEvents All events. Note that DeferredDelete events are processed specially. See QObject.deleteLater() for more details.
QEventLoop.ExcludeUserInputEvents Do not process user input events, such as ButtonPress and KeyPress. Note that the events are not discarded; they will be delivered the next time PySide.QtCore.QEventLoop.processEvents() is called without the ExcludeUserInputEvents flag.
QEventLoop.ExcludeSocketNotifiers Do not process socket notifier events. Note that the events are not discarded; they will be delivered the next time PySide.QtCore.QEventLoop.processEvents() is called without the ExcludeSocketNotifiers flag.
QEventLoop.WaitForMoreEvents Wait for events if no pending events are available.
QEventLoop.DeferredDeletion deprecated - do not use.
PySide.QtCore.QEventLoop.exec_([flags=QEventLoop.AllEvents])
Parameters:flagsPySide.QtCore.QEventLoop.ProcessEventsFlags
Return type:PySide.QtCore.int
PySide.QtCore.QEventLoop.exit([returnCode=0])
Parameters:returnCodePySide.QtCore.int

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.

PySide.QtCore.QEventLoop.isRunning()
Return type:PySide.QtCore.bool

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 PySide.QtCore.QEventLoop.exit() is called.

PySide.QtCore.QEventLoop.processEvents(flags, maximumTime)
Parameters:
  • flagsPySide.QtCore.QEventLoop.ProcessEventsFlags
  • maximumTimePySide.QtCore.int
PySide.QtCore.QEventLoop.processEvents([flags=QEventLoop.AllEvents])
Parameters:flagsPySide.QtCore.QEventLoop.ProcessEventsFlags
Return type:PySide.QtCore.bool
PySide.QtCore.QEventLoop.quit()

Tells the event loop to exit normally.

Same as exit(0).

PySide.QtCore.QEventLoop.wakeUp()

Wakes up the event loop.