Struct qt_core::QEventLoopLocker
source · #[repr(C)]pub struct QEventLoopLocker { /* private fields */ }
Expand description
The QEventLoopLocker class provides a means to quit an event loop when it is no longer needed.
C++ class: QEventLoopLocker
.
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.
Implementations§
source§impl QEventLoopLocker
impl QEventLoopLocker
sourcepub unsafe fn new() -> CppBox<QEventLoopLocker>
pub unsafe fn new() -> CppBox<QEventLoopLocker>
Creates an event locker operating on the QCoreApplication.
Calls C++ function: [constructor] void QEventLoopLocker::QEventLoopLocker()
.
Creates an event locker operating on the QCoreApplication.
The application will quit when there are no more QEventLoopLockers operating on it.
See also QCoreApplication::quit() and QCoreApplication::isQuitLockEnabled().
sourcepub unsafe fn from_q_event_loop(
loop_: impl CastInto<Ptr<QEventLoop>>
) -> CppBox<QEventLoopLocker>
pub unsafe fn from_q_event_loop( loop_: impl CastInto<Ptr<QEventLoop>> ) -> CppBox<QEventLoopLocker>
Creates an event locker operating on the loop.
Calls C++ function: [constructor] void QEventLoopLocker::QEventLoopLocker(QEventLoop* loop)
.
Creates an event locker operating on the loop.
This particular QEventLoop will quit when there are no more QEventLoopLockers operating on it.
See also QEventLoop::quit().
sourcepub unsafe fn from_q_thread(
thread: impl CastInto<Ptr<QThread>>
) -> CppBox<QEventLoopLocker>
pub unsafe fn from_q_thread( thread: impl CastInto<Ptr<QThread>> ) -> CppBox<QEventLoopLocker>
Creates an event locker operating on the thread.
Calls C++ function: [constructor] void QEventLoopLocker::QEventLoopLocker(QThread* thread)
.
Creates an event locker operating on the thread.
This particular QThread will quit when there are no more QEventLoopLockers operating on it.
See also QThread::quit().