Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtCore More...
#include <qeventloop.h>
Public Member Functions | |
Q_NODISCARD_CTOR Q_CORE_EXPORT | QEventLoopLocker () noexcept |
Creates an event locker operating on the QCoreApplication. | |
Q_NODISCARD_CTOR Q_CORE_EXPORT | QEventLoopLocker (QEventLoop *loop) noexcept |
Creates an event locker operating on the loop. | |
Q_NODISCARD_CTOR Q_CORE_EXPORT | QEventLoopLocker (QThread *thread) noexcept |
Creates an event locker operating on the thread. | |
Q_CORE_EXPORT | ~QEventLoopLocker () |
Destroys this event loop locker object. | |
Q_NODISCARD_CTOR | QEventLoopLocker (QEventLoopLocker &&other) noexcept |
void | swap (QEventLoopLocker &other) noexcept |
Friends | |
class | QEventLoopLockerPrivate |
void | swap (QEventLoopLocker &lhs, QEventLoopLocker &rhs) noexcept |
\inmodule QtCore
The QEventLoopLocker class provides a means to quit an event loop when it is no longer needed.
The QEventLoopLocker operates on particular objects - either a QCoreApplication instance, a QEventLoop instance or a QThread instance.
This makes it possible to, for example, run a batch of jobs with an event loop and exit that event loop after the last job is finished. That is accomplished by keeping a QEventLoopLocker with each job instance.
The variant which operates on QCoreApplication makes it possible to finish asynchronously running jobs after the last gui window has been closed. This can be useful for example for running a job which uploads data to a network.
Definition at line 58 of file qeventloop.h.
|
noexcept |
Creates an event locker operating on the QCoreApplication.
The application will attempt to quit when there are no more QEventLoopLockers operating on it, as long as QCoreApplication::isQuitLockEnabled() is true
.
Note that attempting a quit may not necessarily result in the application quitting, if there for example are open windows, or the QEvent::Quit event is ignored.
Definition at line 360 of file qeventloop.cpp.
|
explicitnoexcept |
Creates an event locker operating on the loop.
This particular QEventLoop will quit when there are no more QEventLoopLockers operating on it.
Definition at line 373 of file qeventloop.cpp.
|
explicitnoexcept |
Creates an event locker operating on the thread.
This particular QThread will quit when there are no more QEventLoopLockers operating on it.
Definition at line 386 of file qeventloop.cpp.
QEventLoopLocker::~QEventLoopLocker | ( | ) |
Destroys this event loop locker object.
Definition at line 431 of file qeventloop.cpp.
|
inlinenoexcept |
Move-constructs an event-loop locker from other. other will have a no-op destructor, while responsibility for preventing the QEventLoop/QThread/QCoreApplication from quitting is transferred to the new object.
Definition at line 66 of file qeventloop.h.
|
inlinenoexcept |
Swaps the object and the state of this QEventLoopLocker with other. This operation is very fast and never fails.
Definition at line 70 of file qeventloop.h.
|
friend |
Definition at line 75 of file qeventloop.h.
|
friend |
Swaps the object and the state of lhs with rhs. This operation is very fast and never fails.
Definition at line 71 of file qeventloop.h.