CopperSpice API
1.9.2
|
The QEventLoop class provides a means of entering and leaving an event loop. More...
Public Typedefs | |
using | ProcessEventsFlags = QFlags< ProcessEventsFlag > |
Public Types | |
enum | ProcessEventsFlag |
Public Slots | |
void | quit () |
Public Slots inherited from QObject | |
void | deleteLater () |
Public Methods | |
QEventLoop (QObject *parent=nullptr) | |
~QEventLoop () | |
int | exec (ProcessEventsFlags flags=AllEvents) |
void | exit (int returnCode=0) |
bool | isRunning () const |
void | processEvents (ProcessEventsFlags flags, int maxTime) |
bool | processEvents (ProcessEventsFlags flags=AllEvents) |
void | wakeUp () |
Public Methods inherited from QObject | |
QObject (QObject *parent=nullptr) | |
~QObject () | |
bool | blockSignals (bool block) |
const QList< QObject * > & | children () const |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QString > | dynamicPropertyNames () const |
virtual bool | event (QEvent *event) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
template<class T > | |
QList< T > | findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
bool | inherits (const QString &className) const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const |
bool | isWindowType () const |
void | killTimer (int id) |
const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | property (const QString &name) const |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const QString &name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
QThread * | thread () const |
Additional Inherited Members | |
Public Signals inherited from QObject | |
void | destroyed (QObject *obj=nullptr) |
void | objectNameChanged (const QString &objectName) |
Static Public Methods inherited from QObject | |
static bool | connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ()) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...)) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod) |
static QMetaObject & | staticMetaObject () |
static QString | tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >()) |
Protected Methods inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signalMethod) const |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signalMethod) const |
bool | isSignalConnected (const QMetaMethod &signalMethod) const |
int | receivers (const QString &signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Properties inherited from QObject | |
objectName | |
Related Functions inherited from QObject | |
T | qobject_cast (QObject *object) |
QObjectList | |
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.
Typedef for QFlags<ProcessEventsFlag> which contains an OR combination of ProcessEventsFlag values.
Refer to QEventLoop::ProcessEventsFlag for the enum documentation.
This enum controls the types of events processed by the processEvents() method.
Constant | Value | Description |
---|---|---|
QEventLoop::AllEvents | 0x00 | All events. DeferredDelete events are processed specially. Refer to QObject::deleteLater() for more details. |
QEventLoop::ExcludeUserInputEvents | 0x01 | Do not process user input events, such as ButtonPress and KeyPress. The events are not discarded, they will be delivered the next time processEvents() is called without the ExcludeUserInputEvents flag. |
QEventLoop::ExcludeSocketNotifiers | 0x02 | Do not process socket notifier events. The events are not discarded, they will be delivered the next time processEvents() is called without the ExcludeSocketNotifiers flag. |
QEventLoop::WaitForMoreEvents | 0x04 | Wait for events if no pending events are available. |
QEventLoop::DeferredDeletion | ? | deprecated value, do not use |
|
explicit |
Constructs an event loop object with the given parent.
QEventLoop::~QEventLoop | ( | ) |
Destroys the event loop object.
int QEventLoop::exec | ( | ProcessEventsFlags | flags = AllEvents | ) |
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().
void QEventLoop::exit | ( | int | returnCode = 0 | ) |
Instructs the event loop to exit with a return code. After this method has been called, the event loop returns from the call to exec(). The exec() method returns returnCode. By convention, a returnCode of 0 means success and any non-zero value indicates an error.
Unlike the C library function of the same name, this method returns to the caller, it is the event processing which stops.
bool QEventLoop::isRunning | ( | ) | const |
void QEventLoop::processEvents | ( | ProcessEventsFlags | flags, |
int | maxTime | ||
) |
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 method is useful when there is a long operation and you want to show progress without allowing user input. For this to happen, pass the enum value QEventLoop::ExcludeUserInputEvents in the flags parameter.
bool QEventLoop::processEvents | ( | ProcessEventsFlags | flags = AllEvents | ) |
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 method is useful when there is a long operation and you want to show progress without allowing user input. For this to happen, pass the enum value QEventLoop::ExcludeUserInputEvents in the flags parameter.
This method is simply a wrapper for QAbstractEventDispatcher::processEvents(). Refer to the documentation for that method for more details.
|
slot |
Instructs the event loop to exit normally. Equivalent to calling exit(0).
void QEventLoop::wakeUp | ( | ) |
Wakes up the event loop.