QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | Protected Attributes | List of all members
QgsLayoutItemMetadata Class Reference

Convenience metadata class that uses static functions to create layout items and their configuration widgets. More...

#include <qgslayoutitemregistry.h>

Inheritance diagram for QgsLayoutItemMetadata:
Inheritance graph
[legend]

Public Member Functions

 QgsLayoutItemMetadata (int type, const QString &visibleName, const QString &visiblePluralName, const QgsLayoutItemCreateFunc &pfCreate, const QgsLayoutItemPathResolverFunc &pfPathResolver=nullptr)
 Constructor for QgsLayoutItemMetadata with the specified class type and visibleName, and function pointers for the various item creation functions. More...
 
QgsLayoutItemCreateFunc createFunction () const
 Returns the classes' item creation function. More...
 
QgsLayoutItemcreateItem (QgsLayout *layout) override
 Creates a layout item of this class for a specified layout. More...
 
QgsLayoutItemPathResolverFunc pathResolverFunction () const
 Returns the classes' path resolver function. More...
 
void resolvePaths (QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving) override
 Resolve paths in the item's properties (if there are any paths). More...
 

Protected Attributes

QgsLayoutItemCreateFunc mCreateFunc = nullptr
 
QgsLayoutItemPathResolverFunc mPathResolverFunc = nullptr
 

Detailed Description

Convenience metadata class that uses static functions to create layout items and their configuration widgets.

Note
not available in Python bindings

Definition at line 133 of file qgslayoutitemregistry.h.

Constructor & Destructor Documentation

◆ QgsLayoutItemMetadata()

QgsLayoutItemMetadata::QgsLayoutItemMetadata ( int  type,
const QString &  visibleName,
const QString &  visiblePluralName,
const QgsLayoutItemCreateFunc pfCreate,
const QgsLayoutItemPathResolverFunc pfPathResolver = nullptr 
)
inline

Constructor for QgsLayoutItemMetadata with the specified class type and visibleName, and function pointers for the various item creation functions.

The visiblePluralName argument is used to specify a plural variant of the item type.

Definition at line 143 of file qgslayoutitemregistry.h.

Member Function Documentation

◆ createFunction()

QgsLayoutItemCreateFunc QgsLayoutItemMetadata::createFunction ( ) const
inline

Returns the classes' item creation function.

Definition at line 154 of file qgslayoutitemregistry.h.

◆ createItem()

QgsLayoutItem * QgsLayoutItemMetadata::createItem ( QgsLayout layout)
inlineoverridevirtual

Creates a layout item of this class for a specified layout.

Implements QgsLayoutItemAbstractMetadata.

Definition at line 161 of file qgslayoutitemregistry.h.

◆ pathResolverFunction()

QgsLayoutItemPathResolverFunc QgsLayoutItemMetadata::pathResolverFunction ( ) const
inline

Returns the classes' path resolver function.

Definition at line 159 of file qgslayoutitemregistry.h.

◆ resolvePaths()

void QgsLayoutItemMetadata::resolvePaths ( QVariantMap &  properties,
const QgsPathResolver pathResolver,
bool  saving 
)
inlineoverridevirtual

Resolve paths in the item's properties (if there are any paths).

When saving is true, paths are converted from absolute to relative, when saving is false, paths are converted from relative to absolute. This ensures that paths in project files can be relative, but in item instances the paths are always absolute.

Reimplemented from QgsLayoutItemAbstractMetadata.

Definition at line 163 of file qgslayoutitemregistry.h.

Member Data Documentation

◆ mCreateFunc

QgsLayoutItemCreateFunc QgsLayoutItemMetadata::mCreateFunc = nullptr
protected

Definition at line 170 of file qgslayoutitemregistry.h.

◆ mPathResolverFunc

QgsLayoutItemPathResolverFunc QgsLayoutItemMetadata::mPathResolverFunc = nullptr
protected

Definition at line 171 of file qgslayoutitemregistry.h.


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