QMetaObject::Connection Class
class QMetaObject::Connection公共函数
Connection() | |
Connection(const QMetaObject::Connection &other) | |
Connection(QMetaObject::Connection &&o) | |
~Connection() | |
void | swap(QMetaObject::Connection &other) |
bool | operator bool() const |
QMetaObject::Connection & | operator=(QMetaObject::Connection &&other) |
QMetaObject::Connection & | operator=(const QMetaObject::Connection &other) |
详细说明
代表信号槽(或信号扇区)连接的句柄。
它可用于检查连接是否有效,以及使用QObject::disconnect() 断开连接。对于没有上下文对象的信号扇区连接,这是选择性断开连接的唯一方法。
由于 Connection 只是一个句柄,当 Connection 被销毁或重新分配时,底层的信号槽连接不会受到影响。
成员函数文档
Connection::Connection()
创建连接实例。
Connection::Connection(const QMetaObject::Connection &other)
创建other 连接句柄的副本
[noexcept]
Connection::Connection(QMetaObject::Connection &&o)
移动-创建一个 Connection 实例,使其指向o 所指向的同一对象。
[noexcept]
Connection::~Connection()
QMetaObject::Connection 的 Destructor 。
[noexcept]
void Connection::swap(QMetaObject::Connection &other)
将此 Connection 实例与other 互换。此操作速度非常快,从未出现过故障。
bool Connection::operator bool() const
如果连接有效,则返回true
。
如果QObject::connect 调用成功,则连接有效。如果QObject::connect 无法找到信号或插槽,或者参数不匹配,则连接无效。
[noexcept]
QMetaObject::Connection &Connection::operator=(QMetaObject::Connection &&other)
移动other 并返回一个引用。
QMetaObject::Connection &Connection::operator=(const QMetaObject::Connection &other)
为该连接指定other ,并返回对该连接的引用。
© 2025 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.