NDEVR
API Documentation
QTAbstractResourceListenerabstract

A base class for 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. More...

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

Public Member Functions

 QTAbstractResourceListener (QObject *parent=nullptr)
 Constructs a resource listener tied to a Qt parent object for automatic lifetime management.
virtual void onChanged ()=0
 Called on the main UI thread when the listened resource changes.
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.

Protected Member Functions

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).

Private Member Functions

void onValueChanged () override final
 Called when a subscribed resource value has changed.

Detailed Description

A base class for 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.


onChanged() is guaranteed to be executed in the UI thread.

Definition at line 457 of file QTTools.h.

Constructor & Destructor Documentation

◆ QTAbstractResourceListener()

QTAbstractResourceListener::QTAbstractResourceListener ( QObject * parent = nullptr)
explicit

Constructs a resource listener tied to a Qt parent object for automatic lifetime management.

Parameters
[in]parentOptional parent QObject.

References QTAbstractResourceListener().

Referenced by QTAbstractResourceListener().

Member Function Documentation

◆ hasBeenPosted()

bool QTAbstractResourceListener::hasBeenPosted ( )
inlineprotected

Returns whether a change notification has been posted but not yet executed.

Returns
True if a notification is pending.

Definition at line 482 of file QTTools.h.

◆ isSafeToDelete()

bool QTAbstractResourceListener::isSafeToDelete ( )
inlineprotected

Returns whether it is safe to delete this listener (i.e., not in the middle of a callback).

Returns
True if safe to delete.

Definition at line 477 of file QTTools.h.

◆ onChanged()

virtual void QTAbstractResourceListener::onChanged ( )
pure virtual

Called on the main UI thread when the listened resource changes.

Subclasses must implement this.

Implemented in QTResourceListener.

◆ onValueChanged()

void QTAbstractResourceListener::onValueChanged ( )
finaloverrideprivatevirtual

Called when a subscribed resource value has changed.

Subclasses must implement this to define their response to resource updates.

Implements ResourceListener.


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