![]() |
LeechCraft
0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
|
Executes a given functor upon a signal (or a list of signals). More...
#include "slotclosure.h"
Public Types | |
using | FunType_t = std::function< typename FireDestrPolicy::Signature_t > |
Public Member Functions | |
SlotClosure (const FunType_t &func, QObject *parent) | |
Constructs a SlotClosure running a given func with the given parent as a QObject. More... | |
SlotClosure (const FunType_t &func, QObject *sender, const char *signal, QObject *parent) | |
Constructs a SlotClosure running a given func with the given parent as a QObject on the given signal. More... | |
SlotClosure (const FunType_t &func, QObject *sender, const std::initializer_list< const char * > &signalsList, QObject *parent) | |
Constructs a SlotClosure running a given func with the given parent as a QObject on the given signalsList. More... | |
void | run () override |
Triggers the function and invokes the destroy policy. More... | |
![]() | |
virtual | ~SlotClosureBase ()=default |
Additional Inherited Members | |
![]() |
Executes a given functor upon a signal (or a list of signals).
Refer to the documentation of SlotClosureBase to check constructors and their parameters.
Typical usage:
The instance of this class can either be deleted after the matching signal is emitted, or when the object's parent object is deleted, or when this object is deleted explicitly by the user. The exact behavior is controlled by the FireDestrPolicy template policy.
There are two predefined policies: DeleteLaterPolicy and NoDeletePolicy.
DeleteLaterPolicy deletes the instance of this class after the signal is fired for the first time.
NoDeletePolicy does not delete the object at all. In this case the object will be deleted either explicitly by the user or when its parent QObject is deleted.
FireDestrPolicy | Controls how the object should be destroyed in response to the watched signal. |
Definition at line 91 of file slotclosure.h.
using LC::Util::SlotClosure< FireDestrPolicy >::FunType_t = std::function<typename FireDestrPolicy::Signature_t> |
Definition at line 95 of file slotclosure.h.
|
inline |
Constructs a SlotClosure running a given func with the given parent as a QObject.
This constructor does not automatically connect to any signals. Thus, all interesting signals should be manually connected to the construct object's run()
slot:
[in] | func | The function to run when a connected signal is fired. |
[in] | parent | The parent object of this SlotClosure. |
Definition at line 117 of file slotclosure.h.
|
inline |
Constructs a SlotClosure running a given func with the given parent as a QObject on the given signal.
[in] | func | The function to run when a matching signal is fired. |
[in] | sender | The sender of the signal to connect to. |
[in] | signal | The signal that should trigger the func. |
[in] | parent | The parent object of this SlotClosure. |
Definition at line 132 of file slotclosure.h.
|
inline |
Constructs a SlotClosure running a given func with the given parent as a QObject on the given signalsList.
[in] | func | The function to run when a matching signal is fired. |
[in] | sender | The sender of the signal to connect to. |
[in] | signalsList | The list of signals, any of which triggers the func. |
[in] | parent | The parent object of this SlotClosure. |
Definition at line 155 of file slotclosure.h.
|
inlineoverridevirtual |
Triggers the function and invokes the destroy policy.
Implements LC::Util::SlotClosureBase.
Definition at line 171 of file slotclosure.h.
References LC::Util::oral::sph::f.