LibrePCB Developers Documentation
|
The Signal class is used to emit signals on non-QObject derived classes. More...
#include <signalslot.h>
Public Member Functions | |
Signal ()=delete | |
Signal (const Signal &other)=delete | |
Signal (const Tsender &sender) noexcept | |
Constructor. More... | |
~Signal () noexcept | |
Destructor. More... | |
int | getSlotCount () const noexcept |
Get the count of registered slots. More... | |
void | attach (Slot< Tsender, Args... > &slot) const noexcept |
Attach a slot. More... | |
void | detach (Slot< Tsender, Args... > &slot) const noexcept |
Detach a slot. More... | |
void | notify (Args... args) noexcept |
Notify all attached slots. More... | |
Signal & | operator= (Signal const &other)=delete |
Private Attributes | |
const Tsender & | mSender |
Reference to the sender object. More... | |
QSet< Slot< Tsender, Args... > * > | mSlots |
All attached slots. More... | |
Friends | |
class | Slot< Tsender, Args... > |
The Signal class is used to emit signals on non-QObject derived classes.
The classes librepcb::Signal and librepcb::Slot are similar to Qt's signal/slot concept. The main difference is that senders and receivers of signals do not need to be derived from QObject, thus our own signal/slot mechanism is better suited for low-level classes.
This gives the advantage of avoiding QObject overhead, but has several drawbacks:
Tsender | Type of the sender object |
Args | Arguments passed from librepcb::Signal::notify() to the callbacks |
|
delete |
|
inlineexplicitnoexcept |
Constructor.
sender | Reference to the sender object of the signal |
|
inlinenoexcept |
Destructor.
Automatically disconnects from all slots.
|
inlinenoexcept |
Get the count of registered slots.
|
inlinenoexcept |
Attach a slot.
slot | Reference to the slot to attach |
|
inlinenoexcept |
Detach a slot.
slot | Reference to the slot to detach |
|
inlinenoexcept |
Notify all attached slots.
args | Arguments passed to the slots |
|
friend |
|
private |
Reference to the sender object.
|
mutableprivate |
All attached slots.