Qx v0.6
Qt Extensions Library
Loading...
Searching...
No Matches
Qx::ScopedConnection Class Reference

The ScopedConnection class disconnects a connection when it goes out of scope. More...

#include <qx/utility/qx-helpers.h>

Public Member Functions

 ScopedConnection (const QMetaObject::Connection &connection)
 
 ScopedConnection (ScopedConnection &&other)=default
 
 ~ScopedConnection ()
 
 operator bool () const
 
ScopedConnectionoperator= (ScopedConnection &&other)=default
 

Detailed Description

This is useful when you have a connection that you want disconnected when a certain context is left, but do not have a QObject based context object to use.

See also
scopedConnect().

Constructor & Destructor Documentation

◆ ScopedConnection() [1/2]

Qx::ScopedConnection::ScopedConnection ( const QMetaObject::Connection & connection)
inline

Creates a scoped connection guard from connection.

◆ ScopedConnection() [2/2]

Qx::ScopedConnection::ScopedConnection ( ScopedConnection && other)
inlinedefault

Move constructs a ScopedConnection from other.

◆ ~ScopedConnection()

Qx::ScopedConnection::~ScopedConnection ( )
inline

Destroys the scoped connection guard. The underlying connection will be disconnected if it's valid.

Member Function Documentation

◆ operator bool()

Qx::ScopedConnection::operator bool ( ) const
inline

Returns true if the underlying connection is valid (was successful when connect was called); otherwise, returns false.

◆ operator=()

ScopedConnection & Qx::ScopedConnection::operator= ( ScopedConnection && other)
inlinedefault

Move assigns this ScopedCOnnection using other.


The documentation for this class was generated from the following files: