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. | |
~Signal () noexcept | |
Destructor. | |
int | getSlotCount () const noexcept |
Get the count of registered slots. | |
void | attach (Slot< Tsender, Args... > &slot) const noexcept |
Attach a slot. | |
void | detach (Slot< Tsender, Args... > &slot) const noexcept |
Detach a slot. | |
void | notify (Args... args) noexcept |
Notify all attached slots. | |
Signal & | operator= (Signal const &other)=delete |
Private Attributes | |
const Tsender & | mSender |
Reference to the sender object. | |
QSet< Slot< Tsender, Args... > * > | mSlots |
All attached slots. | |
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 |
|
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 |
|
delete |
|
friend |
|
private |
Reference to the sender object.
|
mutableprivate |
All attached slots.