NDEVR
API Documentation
QTResourceListener

A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object as a parent for automatic destruction with a convenient callback function. More...

Inheritance diagram for QTResourceListener:
[legend]
Collaboration diagram for QTResourceListener:
[legend]

Public Member Functions

 QTResourceListener (const std::function< void()> &callback, QObject *parent)
 Constructs a resource listener that invokes the given callback on the UI thread.
void onChanged () override final
 Invokes the stored callback on the main UI thread.
Public Member Functions inherited from QTAbstractResourceListener
 QTAbstractResourceListener (QObject *parent=nullptr)
 Constructs a resource listener tied to a Qt parent object for automatic lifetime management.
Public Member Functions inherited from ResourceListener
 ResourceListener ()
 Constructs a default ResourceListener.
virtual ~ResourceListener ()
 Virtual destructor.
virtual void addInfoParent (const ResourceBase *info)
 Registers a ResourceBase as a parent that this listener is observing.
void changeValue ()
 Triggers the value changed callback for this listener.
void disable (bool disable)
 Enables or disables this listener.
void disconnectListener ()
 Disconnects this listener from all parent resources it is subscribed to.
uint04 getInfoParentSize () const
 Returns the number of parent resources this listener is subscribed to.
virtual void removeInfoParent (const ResourceBase *info)
 Removes a ResourceBase from the list of parents this listener is observing.

Additional Inherited Members

Protected Member Functions inherited from QTAbstractResourceListener
bool hasBeenPosted ()
 Returns whether a change notification has been posted but not yet executed.
bool isSafeToDelete ()
 Returns whether it is safe to delete this listener (i.e., not in the middle of a callback).

Detailed Description

A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object as a parent for automatic destruction with a convenient callback function.


Definition at line 492 of file QTTools.h.

Constructor & Destructor Documentation

◆ QTResourceListener()

QTResourceListener::QTResourceListener ( const std::function< void()> & callback,
QObject * parent )
explicit

Constructs a resource listener that invokes the given callback on the UI thread.

Parameters
[in]callbackThe function to call when the resource changes.
[in]parentThe parent QObject for lifetime management.

References QTResourceListener().

Referenced by QTResourceListener().


The documentation for this class was generated from the following file: