QEventLoopLocker 类提供离开事件循环的手段,当不再需要时。 更多...
头: | #include <QEventLoopLocker> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
QEventLoopLocker () | |
QEventLoopLocker (QEventLoop * loop ) | |
QEventLoopLocker (QThread * thread ) | |
(从 6.7 起)
|
QEventLoopLocker (QEventLoopLocker && other ) |
~QEventLoopLocker () | |
(从 6.7 起)
void
|
swap (QEventLoopLocker & other ) |
(从 6.7 起)
QEventLoopLocker &
|
operator= (QEventLoopLocker && other ) |
(从 6.7 起)
void
|
swap (QEventLoopLocker & lhs , QEventLoopLocker & rhs ) |
QEventLoopLocker 操作特定对象,如 QCoreApplication 实例, QEventLoop 实例或 QThread 实例。
例如,这使采用事件循环运行一批作业,并在完成最后作业后退出相应事件循环成为可能。这的完成是通过保持 QEventLoopLocker 由各作业实例。
变体操作 QCoreApplication 使它在关闭最后 GUI 窗口之后异步完成运行作业成为可能。例如:这对运行把数据上传到网络的作业是很有用的。
另请参阅 QEventLoop and QCoreApplication .
[noexcept]
QEventLoopLocker::
QEventLoopLocker
()
创建事件锁定器操作 QCoreApplication .
The application will attempt to quit when there are no more QEventLoopLockers operating on it, as long as
QCoreApplication::isQuitLockEnabled
() 是
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 事件被忽略。
另请参阅 QCoreApplication::quit () 和 QCoreApplication::isQuitLockEnabled ().
[explicit noexcept]
QEventLoopLocker::
QEventLoopLocker
(
QEventLoop
*
loop
)
创建事件锁定器操作 loop .
这尤其 QEventLoop 将离开,当没有更多 QEventLoopLockers 操作它时。
另请参阅 QEventLoop::quit ().
[explicit noexcept]
QEventLoopLocker::
QEventLoopLocker
(
QThread
*
thread
)
创建事件锁定器操作 thread .
这尤其 QThread 将离开,当没有更多 QEventLoopLockers 操作它时。
另请参阅 QThread::quit ().
[noexcept, since 6.7]
QEventLoopLocker::
QEventLoopLocker
(
QEventLoopLocker
&&
other
)
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.
该函数在 Qt 6.7 引入。
[noexcept]
QEventLoopLocker::
~QEventLoopLocker
()
销毁此事件循环锁定器对象
[noexcept, since 6.7]
void
QEventLoopLocker::
swap
(
QEventLoopLocker
&
other
)
Swaps the object and the state of this QEventLoopLocker with other 。此操作非常快且从不失败。
该函数在 Qt 6.7 引入。
[noexcept, since 6.7]
QEventLoopLocker
&QEventLoopLocker::
operator=
(
QEventLoopLocker
&&
other
)
Move-assigns this 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 this object.
该函数在 Qt 6.7 引入。
[noexcept, since 6.7]
void
swap
(
QEventLoopLocker
&
lhs
,
QEventLoopLocker
&
rhs
)
Swaps the object and the state of lhs with rhs 。此操作非常快且从不失败。
该函数在 Qt 6.7 引入。