KDDockWidgets API Documentation 2.0
|
A ConnectionHandle represents the connection of a Signal to a slot (i.e. a function that is called when the Signal is emitted). More...
#include <signal.h>
Public Member Functions | |
ConnectionHandle ()=default | |
ConnectionHandle (ConnectionHandle &&)=default | |
ConnectionHandle (const ConnectionHandle &)=default | |
template<typename... Args> | |
bool | belongsTo (const Signal< Args... > &signal) const |
bool | block (bool blocked) |
void | disconnect () |
bool | isActive () const |
bool | isBlocked () const |
ConnectionHandle & | operator= (ConnectionHandle &&)=default |
ConnectionHandle & | operator= (const ConnectionHandle &)=default |
A ConnectionHandle represents the connection of a Signal to a slot (i.e. a function that is called when the Signal is emitted).
It is returned from a Signal when a connection is created and used to manage the connection by disconnecting, (un)blocking it and checking its state.
To make sure a Connection to an object is disconnected correctly, consider storing a ScopedConnection to its ConnectionHandle inside the object.
|
default |
A ConnectionHandle can be default constructed. In this case the ConnectionHandle will not reference any active connection (i.e. isActive() will return false), and not belong to any Signal.
|
default |
A ConnectionHandle can be copied.
|
default |
A ConnectionHandle can be moved.
|
inline |
Check whether this ConnectionHandle belongs to the given Signal.
Definition at line 166 of file signal.h.
Referenced by KDBindings::Signal< Args >::blockConnection(), KDBindings::Signal< Args >::disconnect(), and KDBindings::Signal< Args >::isConnectionBlocked().
|
inline |
Sets the block state of the connection. If a connection is blocked, emitting the Signal will no longer call this connections slot, until the connection is unblocked.
Behaves the same as calling Signal::blockConnection with this ConnectionHandle as argument.
To temporarily block a connection, consider using an instance of ConnectionBlocker, which offers a RAII-style implementation that makes sure the connection is always returned to its original state.
blocked | The new blocked state of the connection. |
std::out_of_range | Throws if the connection is not active (i.e. isActive() returns false). |
Definition at line 137 of file signal.h.
Referenced by KDBindings::ConnectionBlocker::ConnectionBlocker().
|
inline |
Disconnect the slot.
When this function is called, the function that was passed to Signal::connect to create this ConnectionHandle will no longer be called when the Signal is emitted.
If the ConnectionHandle is not active or the connection has already been disconnected, nothing happens.
After this call, the ConnectionHandle will be inactive (i.e. isActive() returns false) and will no longer belong to any Signal (i.e. belongsTo returns false).
Definition at line 101 of file signal.h.
Referenced by KDBindings::Private::PropertyNode< PropertyType >::~PropertyNode(), and KDDockWidgets::Core::ViewGuard::clear().
|
inline |
Check whether the connection of this ConnectionHandle is active.
|
inline |
Checks whether the connection is currently blocked.
To change the blocked state of a connection, call ConnectionHandle::block.
|
default |
|
default |