The QEventLoopLocker class provides a means to quit an event loop when it is no longer needed. More...
|CMake:|| find_package(Qt6 REQUIRED COMPONENTS Core) |
target_link_libraries(mytarget PRIVATE Qt6::Core)
|qmake:||QT += core|
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.
Member Function Documentation
Creates an event locker operating on the QCoreApplication.
The application will quit when there are no more QEventLoopLockers operating on it.
[explicit] 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().
[explicit] 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().
Destroys this event loop locker object
© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.