QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
QgsAbstractProjectStoredObjectManager< T > Class Template Reference

Template class for storage of a set of objects attached to a QgsProject. More...

#include <qgsprojectstoredobjectmanager.h>

Inheritance diagram for QgsAbstractProjectStoredObjectManager< T >:

Public Member Functions

 QgsAbstractProjectStoredObjectManager (QgsProject *project=nullptr)
 Constructor for QgsAbstractProjectStoredObjectManager, for objects attached to the specified project.
 ~QgsAbstractProjectStoredObjectManager () override
T * objectByName (const QString &name) const
 Returns the object with a matching name, or nullptr if no matching objects were found.
QList< T * > objects () const
 Returns the list of objects contained within the manager.
Public Member Functions inherited from QgsProjectStoredObjectManagerBase
 QgsProjectStoredObjectManagerBase (QgsProject *project=nullptr)
 Constructor for QgsProjectStoredObjectManagerBase, for objects attached to the specified project.

Protected Member Functions

bool addObject (T *object)
 Adds an object to the manager.
void clearObjects ()
 Removes and deletes all objects from the manager.
bool removeObject (T *object)
 Removes an object from the manager.
virtual void setupObjectConnections (T *object)
 Sets up additional connections to an object, called when the object is first added to the manager.
Protected Member Functions inherited from QgsProjectStoredObjectManagerBase
void markProjectDirty ()
 Marks the project as dirty.

Protected Attributes

QList< T * > mObjects
 Attached objects, owned by the manager.
Protected Attributes inherited from QgsProjectStoredObjectManagerBase
QgsProjectmProject = nullptr
 Associated project.

Additional Inherited Members

Signals inherited from QgsProjectStoredObjectManagerBase
void objectAboutToBeAdded (const QString &name)
 Emitted when an object is about to be added to the manager.
void objectAboutToBeRemoved (const QString &name)
 Emitted when an object is about to be removed from the manager.
void objectAdded (const QString &name)
 Emitted when an object has been added to the manager.
void objectRemoved (const QString &name)
 Emitted when an object was removed from the manager.

Detailed Description

template<class T>
class QgsAbstractProjectStoredObjectManager< T >

Template class for storage of a set of objects attached to a QgsProject.

QgsAbstractProjectStoredObjectManager handles the storage, serializing and deserializing of attached objects.

QgsAbstractProjectStoredObjectManager retains ownership of all the objects contained in the manager.

Since
QGIS 4.0

Definition at line 91 of file qgsprojectstoredobjectmanager.h.

Constructor & Destructor Documentation

◆ QgsAbstractProjectStoredObjectManager()

template<class T>
QgsAbstractProjectStoredObjectManager< T >::QgsAbstractProjectStoredObjectManager ( QgsProject * project = nullptr)
explicit

Constructor for QgsAbstractProjectStoredObjectManager, for objects attached to the specified project.

Definition at line 43 of file qgsprojectstoredobjectmanager.cpp.

◆ ~QgsAbstractProjectStoredObjectManager()

Member Function Documentation

◆ addObject()

template<class T>
bool QgsAbstractProjectStoredObjectManager< T >::addObject ( T * object)
protected

Adds an object to the manager.

Ownership of the object is transferred to the manager. Returns true if the addition was successful, or false if the object could not be added (eg as a result of a duplicate object name).

See also
removeObject()
objectAdded()

Definition at line 84 of file qgsprojectstoredobjectmanager.cpp.

◆ clearObjects()

template<class T>
void QgsAbstractProjectStoredObjectManager< T >::clearObjects ( )
protected

Removes and deletes all objects from the manager.

See also
removeObject()

Definition at line 74 of file qgsprojectstoredobjectmanager.cpp.

◆ objectByName()

template<class T>
T * QgsAbstractProjectStoredObjectManager< T >::objectByName ( const QString & name) const

Returns the object with a matching name, or nullptr if no matching objects were found.

Definition at line 63 of file qgsprojectstoredobjectmanager.cpp.

◆ objects()

template<class T>
QList< T * > QgsAbstractProjectStoredObjectManager< T >::objects ( ) const

Returns the list of objects contained within the manager.

Definition at line 57 of file qgsprojectstoredobjectmanager.cpp.

◆ removeObject()

template<class T>
bool QgsAbstractProjectStoredObjectManager< T >::removeObject ( T * object)
protected

Removes an object from the manager.

The object is deleted. Returns true if the removal was successful, or false if the removal failed (eg as a result of removing an object which is not contained in the manager).

See also
addObject()
objectRemoved()
objectAboutToBeRemoved()
clearObjects()

Definition at line 110 of file qgsprojectstoredobjectmanager.cpp.

◆ setupObjectConnections()

template<class T>
void QgsAbstractProjectStoredObjectManager< T >::setupObjectConnections ( T * object)
protectedvirtual

Sets up additional connections to an object, called when the object is first added to the manager.

Definition at line 128 of file qgsprojectstoredobjectmanager.cpp.

Member Data Documentation

◆ mObjects

template<class T>
QList< T * > QgsAbstractProjectStoredObjectManager< T >::mObjects
protected

Attached objects, owned by the manager.

Definition at line 116 of file qgsprojectstoredobjectmanager.h.


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