このページでは

QMetaObject::Connection Class

class QMetaObject::Connection

公開関数

Connection()
Connection(const QMetaObject::Connection &other)
Connection(QMetaObject::Connection &&o)
~Connection()
void swap(QMetaObject::Connection &other)
operator bool() const
QMetaObject::Connection &operator=(QMetaObject::Connection &&other)
QMetaObject::Connection &operator=(const QMetaObject::Connection &other)

詳細な説明

シグナル・スロット(またはシグナル・ファンクタ)接続へのハンドルを表します。

これを使用して、接続が有効かどうかを確認したり、QObject::disconnect() を使用して接続を解除したりすることができます。コンテキストオブジェクトのないシグナル-ファンクタ接続の場合、これがその接続を選択的に解除する唯一の方法です。

Connection は単なるハンドルであるため、Connection が破棄されたり再割り当てされたりしても、基盤となるシグナル・スロットの接続には影響しません。

メンバ関数のドキュメント

[noexcept] Connection::Connection()

Connectionインスタンスを作成します。

Connection::Connection(const QMetaObject::Connection &other)

other 接続へのハンドルのコピーを作成します

[noexcept] Connection::Connection(QMetaObject::Connection &&o)

Connectionインスタンスをムーブコンストラクトで生成し、o が指していたのと同じオブジェクトを指すようにします。

[noexcept] Connection::~Connection()

QMetaObject::Connection のデストラクタ。

[noexcept] void Connection::swap(QMetaObject::Connection &other)

この Connection インスタンスを `other` と交換します。この操作は非常に高速で、失敗することはありません。

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 を割り当て、この接続への参照を返します。

© 2026 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.