QgsLayoutItemMetadata class

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

Base classes

class QgsLayoutItemAbstractMetadata
Stores metadata about one layout item class.

Constructors, destructors, conversion operators

QgsLayoutItemMetadata(int type, const QString& visibleName, 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.

Public functions

auto createFunction() const -> QgsLayoutItemCreateFunc
Returns the classes' item creation function.
auto createItem(QgsLayout* layout) -> QgsLayoutItem* override
Creates a layout item of this class for a specified layout.
auto pathResolverFunction() const -> QgsLayoutItemPathResolverFunc
Returns the classes' path resolver function.
void resolvePaths(QVariantMap& properties, const QgsPathResolver& pathResolver, bool saving) override
Resolve paths in the item's properties (if there are any paths).

Function documentation

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

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.