|
psychic-ui 0.0.0
|
#include <Slot.hpp>
Public Member Functions | |
|
template<class S> requires std::derived_from<S, SlotBase> | |
| ScopedSlot (std::shared_ptr< S > slot) | |
| ScopedSlot (const ScopedSlot &)=delete | |
| ScopedSlot & | operator= (const ScopedSlot &)=delete |
| ScopedSlot (ScopedSlot &&other) noexcept | |
| ScopedSlot & | operator= (ScopedSlot &&other) noexcept |
| void | disconnect () |
| bool | connected () const |
| operator bool () const | |
Owning slot handle: disconnects when destroyed or when another slot is assigned to it. Use it for a subscription you replace or drop, typically to a signal that outlives you:
ScopedSlot _onMouseMove;
_onMouseMove = window()->mouseMoved.subscribe([this](...) { ... }); // disconnects the previous one first